ContextSwitchDeadlock was detected - VB .Net


I have developed a VB .Net application that calls a Oracle stored procedure (l_cmdSetting.ExecuteNonQuery) which takes about 10 mins to complete and return focus to the application. During this time the app waits for the SP to complete and displays the message

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

I need the SP to complete before carrying on with application processing.

1) What does this mean?
2) Can I ignore this issue?
3) Do I need to code a fix and if 'yes' what should this be?

Thanks Ian

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Bob LearnedConnect With a Mentor Commented:
This is a big problem, and really depends on a lot of different factors.  I usually get this error when I wait too long looking at code when the IDE is in break-mode.  

Another possibility is referenced in this article:

Why you sometimes get a bogus ContextSwitchDeadLock MDA under the debugger

It talks about debugging managed code that includes unmanaged code.

Here is another possibility:

contextSwitchDeadlock MDA

Forced accept.

EE Admin
All Courses

From novice to tech pro — start learning today.