locked
TransactionAbortedException in TransactionScope constructor RRS feed

  • Question

  • My program uses two nested TransactionScopes and a bit of DbContext stuff for Entity Framework inside these transaction scopes. This is all as described by other tutorials. Still I get the following exception in the nested TransactionScope constructor:

    System.Transactions.TransactionAbortedException: Die Transaktion wurde abgebrochen.
       bei System.Transactions.TransactionStateAborted.CreateAbortingClone(InternalTransaction tx)
       bei System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking)
       bei System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)
       bei System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)
       bei System.Transactions.TransactionScope.PushScope()
       bei System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption, TransactionScopeAsyncFlowOption asyncFlowOption)
       bei System.Transactions.TransactionScope..ctor()

    What does that mean? I never cancelled any transaction up until there. This is when talking to SQL Server 2014, I haven't tested other database systems yet. Using Entity Framework 6.1.3 with .NET 4.6.

    • Moved by Fred Bao Tuesday, August 25, 2015 9:50 AM
    Monday, August 24, 2015 3:15 PM

Answers

  • Oh, sorry, I don't have that code anymore. TransactionScope is a monster, reversing every database development practice, based on hidden magic, and in the end it failed anyway (there was no transaction effect at all). I've changed my code to more traditional DbTransactions and that works well (as expected) now.

    • Proposed as answer by Youjun Tang Wednesday, September 2, 2015 7:49 AM
    • Marked as answer by Fred Bao Monday, September 7, 2015 10:04 AM
    Tuesday, September 1, 2015 8:06 AM

All replies

  • Hi

    >>This is when talking to SQL Server 2014, I haven't tested other database systems yet. Using Entity Framework 6.1.3 with .NET 4.6.

    Based on your description, your case more related to EF, I will move your case to EF forum for better support.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 25, 2015 9:49 AM
  • Hi dg9ngf,

    Could you share some samples which can reproduce the issue and then we could help you better.

    For this TransactionAbortedException error, There are some posts discussing this issue, you could refer to:

    http://stackoverflow.com/questions/7006806/transactionscope-transactionaborted-exception-transaction-not-rolled-back-sho

    http://stackoverflow.com/questions/7950054/using-transactionscope-system-transactions-transactionabortedexception-the-tr

    Regards,
    Youjun Tang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, September 1, 2015 7:48 AM
  • Oh, sorry, I don't have that code anymore. TransactionScope is a monster, reversing every database development practice, based on hidden magic, and in the end it failed anyway (there was no transaction effect at all). I've changed my code to more traditional DbTransactions and that works well (as expected) now.

    • Proposed as answer by Youjun Tang Wednesday, September 2, 2015 7:49 AM
    • Marked as answer by Fred Bao Monday, September 7, 2015 10:04 AM
    Tuesday, September 1, 2015 8:06 AM