title: Visual Studio 2012 Debugger suddenly stops while debugging Azure project
body: <p>When I'm debugging my Azure project (1 Web + 1 Worker Role instance) locally, the debugger often just stops and the role instances are restarting.</p>
  
  <p>I have no clue why this is happening, there are no uncaught exceptions and if I run the project without setting breakpoint everything works just fine. 
  However when I set breakpoints and move through the code using Step Over / Step into, the debugger just stops at random intervals.</p>
  
  <p>Does anyone know what is causing this / where I can find additional logs that may shed some light on this?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Either I overlooked this previously or it didn't get logged to the Output window, but I now got the following error:</p>
  
  <pre><code>First-chance exception at 0x000007fde4a4167f in WaWorkerHost.exe: 0xC0000005: Access violation reading location 0xfffffffffffffff8.
  The Common Language Runtime cannot stop at this exception. Common causes include: incorrect COM interop marshalling, and memory corruption. To investigate further, using native-only debugging.
  </code></pre>
  
  <p>I'm pretty sure that's not my application's fault – as I mentioned, the exact code I'm debugging runs fine when I don't set breakpoints and step through manually. </p>
  
  <p>Any ideas?</p>
  
  <p><strong>Update 2</strong>:</p>
  
  <p>Frome the Bootstrapper (old) log:</p>
  
  <pre><code>[00012264:00001260, 2013/03/26, 11:37:19.777, 00100000] &lt;- CRuntimeClient::OnRoleStatusCallback(0x0000006BD7718C00) =0x800706be
  [00012264:00008432, 2013/03/26, 11:37:19.804, 00100000] &lt;- CRuntimeAgent::RemoveEndpointRegistration(0x0000006BD76F60E0) =0x80070005
  [00012264:00001260, 2013/03/26, 11:37:19.811, 00040000] Client process WaWorkerHost.exe is the role host.
  [00012264:00008432, 2013/03/26, 11:37:19.830, 00100000] &lt;- CRuntimeAgent::UnregisterEndpoint(0x0000006BD76F60E0) =0x80070005
  [00012264:00001260, 2013/03/26, 11:37:19.830, 00080000] Failed to contact the role host process. Treat role as unhealthy.
  </code></pre>
  
  <p>The file ends with that – in the next bootstrapper log, the startup of role instances is being logged. 
  Can it be that debugging prevents the bootstrapper from contacting roles and thus deciding they are unhealthy and must be restarted?</p>
  
  <p><strong>Last Update:</strong></p>
  
  <p>I wiped my project and did a fresh checkout from the repository. As it turns out, there was a missing reference in one of my class libraries. The missing reference never showed up as compile error, supposedly because there was an older version laying around somewhere. </p>
  
  <p>To all others that find themselves in a similar situation, I can only recommend trying to do the same: completely cleaning their code base and see if the issue disappears. In all the logs I searched I never encountered a "MissingReferenceException" – would have saved me a lot of time today</p>