title: How do I check for missing scope.Complete() statements?
body: <p>Programmers on my team sometimes open a transaction and forget to include the scope.Complete() statement (see code block below). Any ideas on ways to either</p>
  <ol>
  <li><p>Search our solution for missing scope.Complete() statements, or</p>
  </li>
  <li><p>Have Visual Studio automatically highlight or raise a warning for missing scope.Complete() statements?</p>
  </li>
  </ol>
  <p>Here's the line we miss:</p>
  <pre><code> using(TransactionScope scope = new TransactionScope())
   {
        /* Perform transactional work here */
        scope.Complete(); &lt;-- we forget this line
        /* Optionally, include a return statement */
   }
  </code></pre>
  <p><b>What I have tried</b><br/> <br/>
  I have tried using a ReSharper Custom Pattern for this purpose, with no luck. Ideally I would search for something like:</p>
  <pre><code>using(TransactionScope scope = new TransactionScope())
  {
      $statements1$
      [^(scope.Complete();)]
      $statements2$
  }
  </code></pre>
  <p>However, ReSharper only accepts regular expressions for identifiers, not for statements, so this does not appear to work (<a href="http://www.jetbrains.com/resharper/webhelp/Reference__Search_with_Pattern.html" rel="nofollow noreferrer">http://www.jetbrains.com/resharper/webhelp/Reference__Search_with_Pattern.html</a>).</p>
  <p>Any ideas? I'm open to using other plugins or tools as well.</p>