Link to home
Start Free TrialLog in
Avatar of Ben Santiardo
Ben SantiardoFlag for United States of America

asked on

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.
Avatar of Jeff Certain
Jeff Certain
Flag of United States of America image

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.

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

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

Sure, Bob. Be that way. :)
Hey, Jeff, how's it going??  I was snagging, pasting, and getting everything just right...
well, you know.... one of these years I'm gonna hit genius in this stuff...
Avatar of Ben Santiardo

ASKER

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...
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.
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...
ASKER CERTIFIED SOLUTION
Avatar of Ben Santiardo
Ben Santiardo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I was able to find my own answer.
I don't understand that solution...
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
Fabulous...I was thrown off by "entire Threading library"...too many options, too little time!!