?
Solved

VS2010 Invalid Cross Thread Causes Immediate Shutdown...

Posted on 2011-05-04
13
Medium Priority
?
525 Views
Last Modified: 2012-06-22
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.
0
Comment
Question by:Ben Santiardo
  • 5
  • 4
  • 4
13 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 35695206
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35695289
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
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 35695318
Sure, Bob. Be that way. :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 35695429
Hey, Jeff, how's it going??  I was snagging, pasting, and getting everything just right...
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 35695434
well, you know.... one of these years I'm gonna hit genius in this stuff...
0
 

Author Comment

by:Ben Santiardo
ID: 35698973
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
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 35699058
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35699062
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
 

Accepted Solution

by:
Ben Santiardo earned 0 total points
ID: 35736892
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
 

Author Closing Comment

by:Ben Santiardo
ID: 35767544
I was able to find my own answer.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35768469
I don't understand that solution...
0
 

Author Comment

by:Ben Santiardo
ID: 35768677
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35769500
Fabulous...I was thrown off by "entire Threading library"...too many options, too little time!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question