title: ContextSwitchDeadlock was detected
body: <p>I am running something similar to the following code in debug mode:</p>
  
  <pre><code>for (int i = 0; i &lt; 5000; i++)
  {
     for (int j = 0; j &lt; 10; j++)
     {
       DoSomething();
     }
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>What can I do to avoid these situations and improve speed?</p>
  
  <p>Thanks!  </p>