does transactionscope get properly disposed?

Viewed 509

I'm finding a possible issue in our code base where the developer forgot to wrap the contents of a using statement with curley braces:

        using (TransactionScope transactionScope = new TransactionScope(Transaction.Current))
            try
            {
                RecordUserConnectionCore(context, userName);
                transactionScope.Complete();
            }
            catch
            {
                transactionScope.Dispose();
                throw;
            }

Does the try/catch get executed inside of the using statement? Is the transactionScope properly disposed?

Please note that this question is in regards to wether the try/catch block is executing inside of the using context. I ask because there are no braces surrounding the try/catch code.

2 Answers
Related