The programmers of my team sometimes open a transaction and forget to include the scope.Complete () operator (see the code block below). Any ideas on how or
(1) find our solution for missing areas scope.Complete () or
(2) Does Visual Studio automatically raise or raise a warning about missing scope.Complete () parameters?
Here is the line we are skipping:
using(TransactionScope scope = new TransactionScope())
{
scope.Complete(); <-- we forget this line
}
What I tried
For this purpose I tried to use a custom ReSharper template with no luck. Ideally, I would look for something like:
using(TransactionScope scope = new TransactionScope())
{
$statements1$
[^(scope.Complete();)]
$statements2$
}
However, ReSharper only accepts regular expressions for identifiers, not for operators, so this does not work ( http://www.jetbrains.com/resharper/webhelp/Reference__Search_with_Pattern.html ).
? .
,