LazyInitializer.EnsureInitialized(ref s_transactionStateAborted, ref s_classSyncObject, () => new TransactionStateAborted());
protected static TransactionStateCommitted TransactionStateCommitted =>
- LazyInitializer.EnsureInitialized(ref s_transactionStateCommitted, ref s_classSyncObject, () => new TransactionStateCommitted());
+ LazyInitializer.EnsureInitialized(ref s_transactionStateCommitted, ref s_classSyncObject, () => new TransactionStateCommitted());
protected static TransactionStateInDoubt TransactionStateInDoubt =>
LazyInitializer.EnsureInitialized(ref s_transactionStateInDoubt, ref s_classSyncObject, () => new TransactionStateInDoubt());
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), e.ToString());
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, e.ToString());
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, e.ToString());
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
- if (tx != null && tx.TransactionTraceId != null && tx.TransactionTraceId.TransactionIdentifier != null)
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx.TransactionTraceId.TransactionIdentifier.ToString(), string.Empty);
- else
- etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, string.Empty, string.Empty);
+ etwLog.TransactionExceptionTrace(TransactionExceptionType.InvalidOperationException, tx?.TransactionTraceId.TransactionIdentifier ?? string.Empty, string.Empty);
}
throw new InvalidOperationException();
{
if (tx._innerException == null)
{
- tx._innerException = new TimeoutException(SR.TraceTransactionTimeout); ;
+ tx._innerException = new TimeoutException(SR.TraceTransactionTimeout);
+ ;
}
tx.PromotedTransaction.Rollback();
{
// The PSPE has returned an invalid promoted transaction.
throw TransactionException.CreateInvalidOperationException(
- TraceSourceType.TraceSourceLtm,
+ TraceSourceType.TraceSourceLtm,
SR.PromotedReturnedInvalidValue,
e,
tx.DistributedTxId
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionCreated(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionCreated(string.Empty, type);
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionCloneCreate(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionCloneCreate(string.Empty, type);
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionSerialized(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionSerialized(string.Empty, type);
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionRollback(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionRollback(string.Empty, type);
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionDependentCloneComplete(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionDependentCloneComplete(string.Empty, type);
WriteEvent(TRANSACTION_DEPENDENT_CLONE_COMPLETE_EVENTID, transactionIdentifier, type);
}
#endregion
-
+
#region Transaction Commit
/// <summary>Trace an event when there is commit on that transaction.</summary>
/// <param name="transaction">The transaction to commit.</param>
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (transaction != null && transaction.TransactionTraceId != null)
+ if (transaction != null && transaction.TransactionTraceId.TransactionIdentifier != null)
TransactionCommit(transaction.TransactionTraceId.TransactionIdentifier, type);
else
TransactionCommit(string.Empty, type);
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentStatus(enlistment.EnlistmentTraceId.EnlistmentIdentifier, notificationCall.ToString());
else
EnlistmentStatus(0, notificationCall.ToString());
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentDone(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentDone(0);
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentPrepared(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentPrepared(0);
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentForceRollback(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentForceRollback(0);
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentAborted(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentAborted(0);
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentCommitted(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentCommitted(0);
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (enlistment != null && enlistment.EnlistmentTraceId != null)
+ if (enlistment != null && enlistment.EnlistmentTraceId.EnlistmentIdentifier != 0)
EnlistmentInDoubt(enlistment.EnlistmentTraceId.EnlistmentIdentifier);
else
EnlistmentInDoubt(0);
/// <param name="transactionID">The transaction ID.</param>
/// <param name="transactionScopeResult">The transaction scope result.</param>
[NonEvent]
- internal void TransactionScopeCreated(TransactionTraceIdentifier transactionID, TransactionScopeResult transactionScopeResult )
+ internal void TransactionScopeCreated(TransactionTraceIdentifier transactionID, TransactionScopeResult transactionScopeResult)
{
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionScopeCreated(transactionID.TransactionIdentifier.ToString(), transactionScopeResult);
- else
- TransactionScopeCreated(string.Empty, transactionScopeResult);
+ TransactionScopeCreated(transactionID.TransactionIdentifier ?? string.Empty, transactionScopeResult);
}
}
{
string currentId = string.Empty;
string newId = string.Empty;
- if (currenttransactionID != null && currenttransactionID.TransactionIdentifier != null)
+ if (currenttransactionID.TransactionIdentifier != null)
{
currentId = currenttransactionID.TransactionIdentifier.ToString();
}
- if (newtransactionID!= null && newtransactionID.TransactionIdentifier != null)
+ if (newtransactionID.TransactionIdentifier != null)
{
newId = newtransactionID.TransactionIdentifier.ToString();
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionScopeNestedIncorrectly(transactionID.TransactionIdentifier.ToString());
- else
- TransactionScopeNestedIncorrectly(string.Empty);
+ TransactionScopeNestedIncorrectly(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionScopeDisposed(transactionID.TransactionIdentifier.ToString());
- else
- TransactionScopeDisposed(string.Empty);
+ TransactionScopeDisposed(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionScopeIncomplete(transactionID.TransactionIdentifier.ToString());
- else
- TransactionScopeIncomplete(string.Empty);
+ TransactionScopeIncomplete(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionScopeTimeout(transactionID.TransactionIdentifier.ToString());
- else
- TransactionScopeTimeout(string.Empty);
+ TransactionScopeTimeout(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionTimeout(transactionID.TransactionIdentifier.ToString());
- else
- TransactionTimeout(string.Empty);
+ TransactionTimeout(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- if (enlistmentID != null)
+ if (enlistmentID.EnlistmentIdentifier != 0)
TransactionstateEnlist(enlistmentID.EnlistmentIdentifier.ToString(), enlistmentType.ToString(), enlistmentOption.ToString());
else
TransactionstateEnlist(string.Empty, enlistmentType.ToString(), enlistmentOption.ToString());
{
if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionCommitted(transactionID.TransactionIdentifier.ToString());
- else
- TransactionCommitted(string.Empty);
+ TransactionCommitted(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionInDoubt(transactionID.TransactionIdentifier.ToString());
- else
- TransactionInDoubt(string.Empty);
+ TransactionInDoubt(transactionID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
{
- string id = string.Empty;
- string distributedId = string.Empty;
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- id= transactionID.TransactionIdentifier.ToString();
- if (distributedTxID != null && distributedTxID.TransactionIdentifier != null)
- distributedId = distributedTxID.TransactionIdentifier.ToString();
- TransactionPromoted(id, distributedId);
+ TransactionPromoted(transactionID.TransactionIdentifier ?? string.Empty, distributedTxID.TransactionIdentifier ?? string.Empty);
}
}
{
if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS))
{
- if (transactionID != null && transactionID.TransactionIdentifier != null)
- TransactionAborted(transactionID.TransactionIdentifier.ToString());
- else
- TransactionAborted(string.Empty);
+ TransactionAborted(transactionID.TransactionIdentifier ?? string.Empty);
}
- }
+ }
[Event(TRANSACTION_ABORTED_EVENTID, Keywords = Keywords.TraceLtm, Level = EventLevel.Warning, Task = Tasks.Transaction, Opcode = Opcodes.Aborted, Message = "Transaction aborted: transaction ID is {0}")]
private void TransactionAborted(string transactionID)
{
Guid guid = Guid.Empty;
- if (str.IndexOf('-')>=0)
+ if (str.IndexOf('-') >= 0)
{ // GUID with dash
- if (str.Length>=36)
+ if (str.Length >= 36)
{
- string str_part1 = str.Substring(0,36);
+ string str_part1 = str.Substring(0, 36);
Guid.TryParse(str_part1, out guid);
}
}
else
{
- if (str.Length>=32)
+ if (str.Length >= 32)
{
- string str_part1 = str.Substring(0,32);
+ string str_part1 = str.Substring(0, 32);
Guid.TryParse(str_part1, out guid);
}
}