title: .NET Framework execution was aborted. Another query caused the AppDomain db.dbo[runtime].4 to be unloaded
body: <p>I have a SQL CLR Function (written in c#.net) that I'm trying to debug. I attach visual studio to the sqlserver process and begin stepping through, but it keeps crashing and ending with the following error message:</p>
  
  <hr>
  
  <p>.NET Framework execution was aborted. Another query caused the AppDomain DatabaseName.dbo[runtime].4 to be unloaded.</p>
  
  <hr>
  
  <p>(The number after DatabaseName.dbo[runtime] changes - increments on each crash)</p>
  
  <p>It sometimes even crashes the sql server process &amp; stops the service.</p>
  
  <p>The function works absolutely fine with no errors when I'm not debugging. This only happens when I'm debugging.</p>
  
  <p>Does anyone have any idea what could be causing this?</p>
  
  <p>Thanks</p>