473,569 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bugs

Recently I've encountered two highly annoying bugs in the framework,
anyone who knows how to solve them would be most appriciated.

1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
quite a bit of testing I found out that the reason for this is that I
didn't have STAThread attribute. Process.Start(u rl) throws when I don't
have an attribute at all, or when I have MTAThrea, anyone can tell me
why?
I looked around, and it seemed that many other people have encountered
this problem. I've the workaround, but I want to know what is going on
here!

2) The following code throw an exception and abort the program, it
shouldn't!

public static void SetExceptionHan dlers()
{
System.AppDomai n.CurrentDomain .UnhandledExcep tion+=new
UnhandledExcept ionEventHandler (CurrentDomain_ UnhandledExcept ion);
System.Windows. Forms.Applicati on.ThreadExcept ion+=new
System.Threadin g.ThreadExcepti onEventHandler
(Application_Th readException);
}

public static void HandleException (Exception ex)
{
if(ex==null)
return;
using(DetailedE rrorInfo dei = new DetailedErrorIn fo(ex))
{
dei.ShowDialog( );
}
}

private static void CurrentDomain_U nhandledExcepti on(object sender,
UnhandledExcept ionEventArgs e)
{
HandleException (e.ExceptionObj ect as Exception);
}

private static void Application_Thr eadException(ob ject sender,
System.Threadin g.ThreadExcepti onEventArgs e)
{
HandleException (e.Exception);
}
[ STAThread()]
public static void Main(string [] args)
{
SetExceptionHan dlers();
Test();
Console.WriteLi ne("Test passeed");

private void Test()
{
throw new InvalidOperatio nException("Tes t");
}

There is nothing wrong here as far as I can tell, but it still will give
me the silly default dialog. The whole point is to have a better dialog
there!

3) Not related to bugs, but does anyone knows whatever there is a way to
know at *runtime* whatever this is a debug or release build?
Nov 22 '05 #1
20 2010
Ayende Rahien wrote:
3) Not related to bugs, but does anyone knows whatever there is a way
to know at *runtime* whatever this is a debug or release build?


The main problem that you first have to define: What is the different
between release and debug build?

From the CLR-View the only difference is the
"System.Diagnos tics.Debuggable Attribute"-Attribute.

This attribute has two properties:
- IsJITTrackingEn abled
- IsJITOptimizerD isabled

If both are "false", then you have a release build.

See:
http://msdn.microsoft.com/library/en-
us/cpref/html/frlrfsystemdiag nostics
debuggableattri buteclasstopic. asp
An other difference might be the generation of PDB-Files. But the
current VS2002/2003 only support the generation of PDB-files with boths
attribut-members set to "true".

If you compile via command-line you can build a release version (no
DebuggableAttri bute-Attribute or both set to false) AND have a PDB-file
generated.
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
Nov 22 '05 #2
Ayende Rahien wrote:
3) Not related to bugs, but does anyone knows whatever there is a way
to know at *runtime* whatever this is a debug or release build?


The main problem that you first have to define: What is the different
between release and debug build?

From the CLR-View the only difference is the
"System.Diagnos tics.Debuggable Attribute"-Attribute.

This attribute has two properties:
- IsJITTrackingEn abled
- IsJITOptimizerD isabled

If both are "false", then you have a release build.

See:
http://msdn.microsoft.com/library/en-
us/cpref/html/frlrfsystemdiag nostics
debuggableattri buteclasstopic. asp
An other difference might be the generation of PDB-Files. But the
current VS2002/2003 only support the generation of PDB-files with boths
attribut-members set to "true".

If you compile via command-line you can build a release version (no
DebuggableAttri bute-Attribute or both set to false) AND have a PDB-file
generated.
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
Nov 22 '05 #3
Ayende Rahien wrote:
1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
quite a bit of testing I found out that the reason for this is that I
didn't have STAThread attribute. Process.Start(u rl) throws when I don't
have an attribute at all, or when I have MTAThrea, anyone can tell me
why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
Nov 22 '05 #4
Ayende Rahien wrote:
1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
quite a bit of testing I found out that the reason for this is that I
didn't have STAThread attribute. Process.Start(u rl) throws when I don't
have an attribute at all, or when I have MTAThrea, anyone can tell me
why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp

Do you need daily reports from your server?
http://sourceforge.net/projects/srvreport/
Nov 22 '05 #5

"Jochen Kalmbach" <no************ ********@holzma .de> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
Ayende Rahien wrote:
1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
quite a bit of testing I found out that the reason for this is that I
didn't have STAThread attribute. Process.Start(u rl) throws when I don't
have an attribute at all, or when I have MTAThrea, anyone can tell me
why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?


This is the full source code that cause the problem:

public class Test
{
[System.MTAThrea d()]//NOTICE this, without this, everything works.
public static void Main(string []args)
{
System.Diagnost ics.Process.Sta rt("http://www.google.com" );
}
}

Cause Win32Exception with "The requested section was not present in the
activation context"
I can't repreduce the problem of no *Thread attribute in a simple example
(complex stuff about threading and winforms.
Nov 22 '05 #6

"Jochen Kalmbach" <no************ ********@holzma .de> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
Ayende Rahien wrote:
1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
quite a bit of testing I found out that the reason for this is that I
didn't have STAThread attribute. Process.Start(u rl) throws when I don't
have an attribute at all, or when I have MTAThrea, anyone can tell me
why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?


This is the full source code that cause the problem:

public class Test
{
[System.MTAThrea d()]//NOTICE this, without this, everything works.
public static void Main(string []args)
{
System.Diagnost ics.Process.Sta rt("http://www.google.com" );
}
}

Cause Win32Exception with "The requested section was not present in the
activation context"
I can't repreduce the problem of no *Thread attribute in a simple example
(complex stuff about threading and winforms.
Nov 22 '05 #7
The ThreadAttribute can't be the problem source.

Willy.
"Ayende Rahien" <Ay****@no.spam > wrote in message
news:er******** ******@tk2msftn gp13.phx.gbl...

"Jochen Kalmbach" <no************ ********@holzma .de> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
Ayende Rahien wrote:
> 1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
> quite a bit of testing I found out that the reason for this is that I
> didn't have STAThread attribute. Process.Start(u rl) throws when I don't
> have an attribute at all, or when I have MTAThrea, anyone can tell me
> why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?


This is the full source code that cause the problem:

public class Test
{
[System.MTAThrea d()]//NOTICE this, without this, everything works.
public static void Main(string []args)
{
System.Diagnost ics.Process.Sta rt("http://www.google.com" );
}
}

Cause Win32Exception with "The requested section was not present in the
activation context"
I can't repreduce the problem of no *Thread attribute in a simple example
(complex stuff about threading and winforms.

Nov 22 '05 #8
The ThreadAttribute can't be the problem source.

Willy.
"Ayende Rahien" <Ay****@no.spam > wrote in message
news:er******** ******@tk2msftn gp13.phx.gbl...

"Jochen Kalmbach" <no************ ********@holzma .de> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
Ayende Rahien wrote:
> 1) I'm trying to do Process.Start(u rl); and get a Win32Exception, after
> quite a bit of testing I found out that the reason for this is that I
> didn't have STAThread attribute. Process.Start(u rl) throws when I don't
> have an attribute at all, or when I have MTAThrea, anyone can tell me
> why?


Can you please provide a working example !?
Are you using "UseShellExecut e" or normal start with "CreateProc ess" !?


This is the full source code that cause the problem:

public class Test
{
[System.MTAThrea d()]//NOTICE this, without this, everything works.
public static void Main(string []args)
{
System.Diagnost ics.Process.Sta rt("http://www.google.com" );
}
}

Cause Win32Exception with "The requested section was not present in the
activation context"
I can't repreduce the problem of no *Thread attribute in a simple example
(complex stuff about threading and winforms.

Nov 22 '05 #9

"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:e4******** ******@TK2MSFTN GP10.phx.gbl...
The ThreadAttribute can't be the problem source.


Test it, then.
Using MTAThread - exception
Using STAThread - working
Not using at all - works (but I'd some problems with that)
Nov 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1640
by: Mudge | last post by:
Hi, I'm trying to help my hosting company decide whether or not to upgrade to php 5. My hosting company does not want to upgrade to php 5 if it has bugs that would cause problems. So i'm doing a little research trying to find out if php 5 has any bugs. Does anybody know of any bugs in php 5? Mudge
83
3391
by: kartik | last post by:
there seems to be a serious problem with allowing numbers to grow in a nearly unbounded manner, as int/long unification does: it hides bugs. most of the time, i expect my numbers to be small. 2**31 is good enough for most uses of variables, and when more is needed, 2**63 should do most of the time. granted, unification allows code to work...
3
1440
by: Brett C. | last post by:
Anthony Baxter, our ever-diligent release manager, mentioned this past week that Python 2.3.5 will most likely come to fruition some time in January (this is not guaranteed date). This means that in order to have enough time to proper evaluate new patches and bugs they must be reported **now**! A one month lead time is necessary to properly...
4
1725
by: Alex Bell | last post by:
There have been several postings recently dealing with bugs in Internet Explorer. Can anyone point me to a review of these bugs and how to work around them? Regards, Alex
20
4102
by: Prashanth Badabagni | last post by:
hi, i'm prashanth Badabagni .. Can anyone tell me the BUGS present in C language whether programming or syntactical BUGS .... Thanks in advance ... Prashanth Badabagni
9
1456
by: David Teran | last post by:
Hi, we are currently using another database product but besides some licensing issues we are finding more and more problems with the database. We are evaluating PostgreSQL and it looks quite handy. Interesting features paired with good performance and a lot of users seems to be a prove for the quality. I wonder if people encountered bugs...
2
2211
by: TheSteph | last post by:
Using : Windows 2000 Pro SP4 / VS.NET 2005 / .NET 2.0 / C# - All updates done. I have several bugs when I use the DataGridView : When scrolling (or after scrolling) the grid have these problems :
19
2180
by: Alan Silver | last post by:
Hello, Having discovered what I believe to be two CSS bugs in IE7, I have submitted bug reports to MS. AFAIK, these don't get acted on until they receive votes form others to say they are worth investigating. As (I naively assume) it's in everyone's interest to see IE7 support CSS properly, would anyone care to vote for these bugs, so...
15
2137
by: Gary Peek | last post by:
Can anyone tell us the browsers/versions that exhibit errors when tables are nested too deeply? And how many levels of nesting produces errors? (not a tables vs CSS question)
87
5489
by: CJ | last post by:
Hello: We know that C programs are often vulnerable to buffer overflows which overwrite the stack. But my question is: Why does C insist on storing local variables on the stack in the first place? I can see two definite disadvantages with this: 1) deeply nested recursive calls to a function (especially if it defines
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.