title: .NET - ContextSwitchDeadlock was detected
body: <p>i have a class in c# (.net 3.5 cp, vs2010) which executes complex comuptations which ussually take a long time. After a minute there is thrown an exception, that ContextSwitchDeadlock was detected. Exception is localised, to my non english language so i cant copy paste, but meaning is following:
  ¨
  CLR module could not transition from context COM ... to context COM ... for 60 seconds. Subproces which owns target context/apartment is probably doing  a non-pumping wait or processing a very long running operation without pumping Windows system messages. </p>
  
  <p>Basicaly, it looks like my application is computing and not responding to windows for a long time and visual studio shuts it  down and reports problable deadlock.</p>
  
  <p>I was trying to do some research and found two solutions:</p>
  
  <ol>
  <li><p>Disable some option in visual studio debbuger to detect deadlocks. Dost not work for me because it woirks only for debugging purposes.</p></li>
  <li><p>Call some DoEvents method, but it was for windows forms and not WPF and i am using WPF.</p></li>
  </ol>
  
  <p>There was also suggestion to create separate thread, but i am complete new to threading and dont know what should i do. Any suggestions please?</p>