title: Using IsolationLevel.Snapshot but DB is still locking
body: <p>I'm part of a team building an ADO.NET based web-site.  We sometimes have several developers and an automated testing tool working simultaneously a development copy of the database.</p>
  
  <p>We use snapshot isolation level, which, to the best of my knowledge, uses optimistic concurrency:  rather than locking, it hopes for the best and throws an exception if you try to commit a transaction if the affected rows have been altered by another party during the transaction.</p>
  
  <p>To use snapshot isolation level we use:</p>
  
  <pre><code>ALTER DATABASE &lt;database name&gt;
  SET ALLOW_SNAPSHOT_ISOLATION ON;
  </code></pre>
  
  <p>and in C#:</p>
  
  <pre><code>Transaction = SqlConnection.BeginTransaction(IsolationLevel.Snapshot);
  </code></pre>
  
  <p>Note that IsolationLevel Snapshot isn't the same as ReadCommitted Snapshot, which we've also tried, but are not currently using.</p>
  
  <p>When one of the developers enters debug mode and pauses the .NET app, they will hold a connection with an active transaction while debugging.  Now, I'd expect this not to be a problem - after all, all transactions are using snapshot isolation level, so while one transaction is paused, other transactions should be able to proceed normally since the paused transaction isn't holding any locks.  Of course, when the paused transaction completes, it is likely to detect a conflict; but that's acceptable so long as other developers and the automated tests can proceed unhindered.</p>
  
  <p>However, in practice, when one person halts a transaction while debugging, all other DB users attempting to access the same rows are blocked despite using snapshot isolation level.</p>
  
  <p>Does anybody know why this occurs, and/or how I can achieve true optimistic (non-blocking) concurrency?</p>
  
  <p><em>The resolution (an unfortunate one for me)</em>: <a href="https://stackoverflow.com/users/105929/remus-rusanu" title="Remus Rusanu">Remus Rusanu</a> noted that writers always block other writers; this is backed up by <a href="http://msdn.microsoft.com/en-us/library/tcbchxcb.aspx" rel="nofollow noreferrer" title="Snapshot Isolation in SQL Server (ADO.NET)">MSDN</a> - it doesn't quite come out and say so, but only ever mentions avoiding reader-writer locks.  In short, the behavior I want isn't implemented in SQL Server.</p>