When I run my scripts from within Visual Studio, I occasionally get this Context Switch Deadlock break mode popping up. It doesn't always happen in the same place in the script or always happen in the script itself. Most of the time it works fine. I've just been noticing it more lately and thought I'd ask a few questions relating to it...
Here is the full message:
ContextSwitchDeadlock occurred Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\TFS\xxxx\Debug\EXPENSE_CCFEED_BAT_03.vshost.exe'. Additional information: The CLR has been unable to transition from COM context 0xf74106f8 to COM context 0xf7410820 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.1) It seems to always happen when I'm on a line of Ranorex code, such as a Find. Yes I have timeouts for the finds.
2) I have <STAThread()> around my main class of my script. Do I perhaps need to do more in other functions or classes that are called by this?
3) If nothing can be done in code, does anyone know how to turn this break off? I never care when I see it and always uncheck it and hit continue.