ContextSwitchDeadlock was detected

G

garth

When I running my program in ste-by-step mode I get his error message, it
does not seem to apply when running in stand alone mode. What is the best to
debug this error message?

ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x1a19d8 to
COM context 0x1a1b48 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.
 
H

hayworth

Good question that I'd like an answer to also. I got your error
message also today. I got a run time error on my target computer and
decided to process the data on my development computer and step through
it in the debugger to see exactly what was going wrong. Well I was
stepping through a perfectly benign for loop and at random times it
would either give the message you listed (about pumping, apartments,
and threads), or just hang. When it hung, it was supposed to step on a
perfectly fine code statement, like an endif statement or a boolean
test in an if statement. (The line of code that it would hang on would
vary from run to run.) Then it would make a sound like it was hitting
a breakpoint, even though the next statement didn't have a break point
set there. There was no yellow arrow, no highlighted line of code,
nothing. If I clicked on the Go triangle again, it would say, from a
balloon in the task tray,

"Microsoft Visual Studio Delay Notification
Microsoft Visual Studio is waiting for an internal operation to
complete. If you regularly encounter this delay during normal usage,
please report this problem to Microsoft."

The only way to get out of it was to kill off my app's executable that
was running (via Task manager or right-clicking in the task bar and
saying "Close Group". Then it would return to the development
environment.
I went to lunch and came back and then everything was OK - I couldn't
get anything strange to happen again. This after hours of pumping and
waiting messages before lunch! I still don't know what happened. Let
me know if anyone else has encountered these strange messages.
 
G

garth

I post a bug mesage to the Express Website. So far no one has gotten back to
me. I can tell you that a Reboot will prolong the tiem between error
messages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top