>Why is this ContextSwitchDeadlock error popping now in
>VS 2005 where it didn't before, and is there a way to avoid
>it without losing the edit on-the-fly feature?
The ContextSwitchDeadlock is one of managed debugging assistants (MDA)
which are debugging aids that work in conjunction with the common language
runtime (CLR) to provide information on runtime state. The MDA is a new
feature in Visual Studio 2005.
The ContextSwitchDeadlock MDA is activated when a deadlock is detected
during an attempted COM context transition, its most probable cause is that
a single-threaded apartment (STA) thread is not pumping messages.
You can disable this kind of MDA by using application-specific
configuration settings, without requirement of "Enable unmanaged code
debugging". For example, add the following code to your project's
ApplicationName.mda.config file:
<mdaConfig>
<assistants>
<contextSwitchDeadlock enable="false" />
</assistants>
</mdaConfig>
Please refer to the following MSDN2 documentation for the details:
Diagnosing Errors with Managed Debugging Assistants
http://msdn2.microsoft.com/en-us/library/d21c150d(en-us,VS.80).aspx
ContextSwitchDeadlock
http://msdn2.microsoft.com/en-us/library/ms172233.aspx
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
I tend to use the console Output window a lot when I am debugging, and I've
noticed that the ContextSwitchDeadlock message occurs frequently when the
program is outputting a lot of text to the Output window. Also, when the
ContextSwitchDeadlock window pops up, if I just hit OK or Continue, the
program just continues as if nothing happened. I am puzzled as to what this
is all about.
--
Ed
>I could not find an ApplicationName.mda.config file (I didn't see
>anything like it, and I searched the solution's folder for .mda.config
>and nothingappeared).
The ApplicationName.mda.config file is not a default project file, you can
create an empty xml file and then copy the MSDN sample code to it, then
save it to the directory of your output app assembly(note: the"
ApplicationName" is just the app assembly's name.)
eg:
MyApp\bin\Debug\MyApp.exe
MyApp\bin\Debug\MyApp.mda.config (create this file)
>If I'm getting these ContextSwitchDeadlock messages,
>is there a problem with the code that should be fixed?
yes, this is a warning message, you need to check your code is there any
similar problem it implied...
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! �§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Thread-Topic: Q on editing while debugging in new VS 2005
>thread-index: AcXsgYY8Fs7VFKMrRQqKVvrt2YV2ag==
>X-WBNR-Posting-Host: 66.65.179.211
>From: "=?Utf-8?B?RWQgV2hpdGU=?=" <ewh...@newsgroups.nospam>
>References: <C60E67A5-8002-4621...@microsoft.com>
<gSKxAtA7...@TK2MSFTNGXA02.phx.gbl>
>Subject: RE: Q on editing while debugging in new VS 2005
>Date: Fri, 18 Nov 2005 12:49:09 -0800
>Lines: 63
>Message-ID: <6462FDF3-69CE-4B1A...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 8bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.vsnet.debugging
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.vsnet.debugging:8162
>X-Tomcat-NG: microsoft.public.vsnet.debugging
I'm writing a server app and have been careful NOT to use anything unmanaged
anywhere. There is no use of COM objects anywhere and, by the time of this
error popping up on me, I still haven't initialized the remoting aspects of
the server (haven't published it). Despite all this, I still get this error
more often than not. I do get the impression it turns up if I'm idle too
long during debugging but I don't really know if this has anyting to do with
it.
If there is an underlying problem with my program, what should I look for?
If I don't go very fast debugging, just waiting to step to the next line
invokes this MDA. Of course the UI thread is not pumping its messages: I'm
sitting at a breakpoint!
I thought (hoped) it was just a side-effect of the WinFX January CTP...
Putting this in Program.exe.mda.config has possibly avoided this MDA and
I've now been able to debug for at least a whole minute...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<mdaConfig>
<assistants>
<contextSwitchDeadlock enable="false" />
</assistants>
</mdaConfig>
</configuration>
Thanks.. I hope it continues to work now.
The MDA still triggers. It's a little different though, sometimes I can
resume debugging by pressing F5. One time the program hung without the MDA
coming up, and another time it hit the MDA and then hung, I think.
But I can debug for a longer period of time (couple minutes) before the MDA
comes up.
Come to think of it, I am using a COM interop assembly, but I thought this
happened regardless of that.
Note: I'm also using CTP builds, so I thought that had mostly to do with it.
Is anyone encountering this on the release 2006 installation?