System.Transactions.TransactionException.CreateTransactionCompletedException C# (CSharp) Method

CreateTransactionCompletedException() static private method

static private CreateTransactionCompletedException ( Guid distributedTxId ) : Exception
distributedTxId Guid
return Exception
        internal static Exception CreateTransactionCompletedException(Guid distributedTxId)
        {
            string messagewithTxId = SR.TransactionAlreadyCompleted;
            if (IncludeDistributedTxId(distributedTxId))
                messagewithTxId = string.Format(SR.DistributedTxIDInTransactionException, messagewithTxId, distributedTxId);

            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, messagewithTxId, string.Empty);
            }

            return new InvalidOperationException(messagewithTxId);
        }

Usage Example

 public void Complete()
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "DependentTransaction.Complete");
     }
     lock (base.internalTransaction)
     {
         if (base.Disposed)
         {
             throw new ObjectDisposedException("Transaction");
         }
         if (base.complete)
         {
             throw TransactionException.CreateTransactionCompletedException(System.Transactions.SR.GetString("TraceSourceLtm"));
         }
         base.complete = true;
         if (this.blocking)
         {
             base.internalTransaction.State.CompleteBlockingClone(base.internalTransaction);
         }
         else
         {
             base.internalTransaction.State.CompleteAbortingClone(base.internalTransaction);
         }
     }
     if (DiagnosticTrace.Information)
     {
         DependentCloneCompleteTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), base.TransactionTraceId);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "DependentTransaction.Complete");
     }
 }
All Usage Examples Of System.Transactions.TransactionException::CreateTransactionCompletedException