VS2010 Invalid Cross Thread Causes Immediate Shutdown...

We recently started migrating from VS2005 to VS2010.  One of the differences I found was that in VS2005 when an "Invalid Cross Thread" was encountered, the application (in debug mode) would crash and highlight the line where the error was encountered. This was great because you got to see the error.

In VS2010...the application simply terminates. No error at all is shown in the IDE when debugging.  Is there a "setting" in VS2010 to make it behave like it did in previous incarnations?  I find it ridiculous that that Microsoft programmed the IDE to just "quit" the running application on a Cross Thread error without any other information.  It took me a long time to find WHERE my application was "crashing" to begin with because of this problem, and then it took me more time after that to realize the reason was a Cross Thread operation.
Ben SantiardoAsked:
Who is Participating?
 
Ben SantiardoAuthor Commented:
Well, I've found that if I check of the entire Threading library (although there is no specific "Cross-Thread Operation" exception listed), the IDE now does indeed stop on a Cross-Thread error.
0
 
Jeff CertainCommented:
Generally, turning on debugging exceptions when they occur helps.

Either Debug >> Exceptions, or Ctrl+Alt+E. You'll see CLR exceptions in the list (second from the top). Check the "Thrown" column and save the setting.

0
 
Bob LearnedCommented:
There are a lot of configurations for how the debugger works when it reaches an exception:

http://www.experts-exchange.com/blogs/TheLearnedOne/B_4666-NET-Debugging-VS-NET-2010-Options.html

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Jeff CertainCommented:
Sure, Bob. Be that way. :)
0
 
Bob LearnedCommented:
Hey, Jeff, how's it going??  I was snagging, pasting, and getting everything just right...
0
 
Jeff CertainCommented:
well, you know.... one of these years I'm gonna hit genius in this stuff...
0
 
Ben SantiardoAuthor Commented:
Thank you guys for the information.  However...still don't see where (or if possible) to set the IDE to actually "break" on a InvalidCrossThread instead of terminating the app completely.  I saw the System.Threading in the CLR section of the "Exception" page.  However, I don't see a InvalidCrossThread option...
0
 
Jeff CertainCommented:
I'd turn on all the CLR Exceptions long enough to diagnose the problem.

I'm not sure where the exception you're getting lives... but it's likely *not* the Threading library, since it's a UI-specific exception.
0
 
Bob LearnedCommented:
I was just trying to say that certain configuration settings can affect how the debugger breaks.  I don't specifically remember a setting that relates to invalid cross thread exceptions, so it is my guess that there was another setting affecting this IDE behavior...
0
 
Ben SantiardoAuthor Commented:
I was able to find my own answer.
0
 
Bob LearnedCommented:
I don't understand that solution...
0
 
Ben SantiardoAuthor Commented:
I'm sorry, I thought with all the discussions centering on the Exceptions window, I thought my answer was self explantory.  My apologies if it was vague.

1) Follow Menu Sturucture Debug > Exceptions
2) Open the CLR item
3) Click on the Thrown option for System.Threading
0
 
Bob LearnedCommented:
Fabulous...I was thrown off by "entire Threading library"...too many options, too little time!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.