Welcome to Sol 3 Sign in | Join | Help
CS Search | Live Search Search

Sol 3

Home of Barrows Software Solutions, LLC

Keith Barrows - StarPilot

Subjects range from Personal to Technical.

ContextSwitchDeadlock was detected Message

Well. You would certainly think that after installing VS 2005 and runnin it as many times as I have I would remember to set the MDA switches as one of my first actions.  But no.  It takes an error like this to remind me:

 

ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from COM context 0x1a7d00 to COM context 0x1a7e70 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

And I'm supposed to be a professional.  You would think I would remember to set the MDAs.  Not!  In fact, a lot of people I talked to at work had no clue what a MDA was or what it was used for!  From MSDN - Diagnosing Errors with Managed Debugging Assistants:

 

Managed debugging assistants (MDAs) are debugging aids that work in conjunction with the common language runtime (CLR) to provide information on runtime state. The assistants generate informational messages about runtime events that you cannot otherwise trap. You can use MDAs to isolate hard-to-find application bugs that occur when transitioning between managed and unmanaged code. You can enable or disable all MDAs by adding a key to the Windows registry or by setting an environment variable. You can enable specific MDAs by using application configuration settings. You can set additional configuration settings for some individual MDAs in the application's configuration file. Because these configuration files are parsed when the runtime is loaded, you must enable the MDA before the managed application starts. You cannot enable it for applications that have already started.

So, how do you set them you ask? In this particular case you do the following:

  • In Visual Studio, goto “Debug” -> “Exceptions…” menu  (Ctrl-D, E)
  • Open the Managed Debugging Assistants tree
  • Uncheck ContextSwitchDeadlock
Hope that helps someone else.  I also have it captured now so the next time I set up a machine I won't have to google the error to find the solution.  Smile
Published Monday, February 12, 2007 3:28 PM by Keith Barrows
Filed under: ,

Comments

No Comments
New Comments to this post are disabled

About Keith Barrows

I've been in computing since 1975. I started on an old PDP-8J with 3k of memory and 2 teletypes. I learned BASIC and Octal based assembly. I later moved into CPM, TR-DOS, Apple and finally into PC-DOS, Dr DOS and MS-DOS. I've been a beta tester for over a decade, got into web applications as a means to handle B2B requirements and have specialized in data movement between applications and businesses since. I have been a MVP, ASP Elite and was selected by Microsoft as one of the original 15 board members for ASPInsiders.

This Blog

Syndication

News

Disclaimer
About me

Locations of visitors to this page
weblogs.asp.net/kbarrows
BlogMailr Enabled <script type='text/javascript' src='http://track3.mybloglog.com/js/jsserv.php?mblID=2008010310421330'&gt;&lt;/script> <script type="text/javascript" src="http://pub.mybloglog.com/comm2.php?mblID=2008010310421330&amp;c_width=180&amp;c_sn_opt=y&amp;c_rows=5&amp;c_img_size=f&amp;c_heading_text=Recent+Readers&amp;c_color_heading_bg=005A94&amp;c_color_heading=ffffff&amp;c_color_link_bg=E3E3E3&amp;c_color_link=005A94&amp;c_color_bottom_bg=005A94"></script>
CS Build: 2.1.61129.2
1999
Listed on the CS Listings Powered By Community Server Themed by nb development