Search code examples
transactionsmsdtc

Determine whether the transaction is DTC transaction or not when debugging


In .Net, is there any way to determine whether the ambient transaction is DTC transaction or not when debugging. I investigated SqlConnection class members but I found nothing. thanks.


Solution

  • I prefer to check the DistributedIdentifier Property.

    In the immediate window while debugging type:

    System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier
    


    If the value is Guid.Empty {00000000-0000-0000-0000-000000000000} then it is not a distributed transaction (the documentation says null but this is wrong since it is not a nullable type). Any other Guid value indicates that the transaction has been promoted to a distributed transaction.