I am running something similar to the following code in debug mode:
for (int i = 0; i < 5000; i++)
{
for (int j = 0; j < 10; j++)
{
DoSomething();
}
}
From time to time I am getting "ContextSwitchDeadlock was detected" from VS 2010. It seems that performance degrades with less RAM available. I have 8GB and able to run the program in around 8 minutes (there are LOTS of DB hits after the loops are done, so 8 minutes is not the loop time), on 4GB machines the time is doubled! From what I red,The MDA is fired because my loop runs for longer than 60 seconds. Essentially, it is a warning that a code is completely blocking the application.
What can I do to avoid these situations and improve speed?
Thanks!
You can ignore that exception (I've run into this before myself for long running methods).
ctrl+alt+e
Find
ContextSwitchDeadlock
and press EnterThrown
in the tableExceptions
configuration window by pressing OK