Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6552319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:26:44+00:00 2026-05-25T12:26:44+00:00

I want the TxJobs , which are running in parallel, to create a scope

  • 0

I want the TxJobs, which are running in parallel, to create a scope from this parent transaction. How do I make this work?

using (var tx = TransactionScope()) {
    Parallel.Invoke(TxJob1, TxJob2) ;
    tx.Complete();
}

I passed in a DependentClone:

using (var tx = new TransactionScope()) {
    var dtx1 = Transaction.Current.DependentClone(
        DependentCloneOption.RollbackIfNotComplete) ;
    var dtx2 = Transaction.Current.DependentClone(
        DependentCloneOption.RollbackIfNotComplete) ;
    Parallel.Invoke(() => TxJob1(dtx1), () => TxJob2(dtx2)) ;
    tx.Complete();
}

In the TxJob1 and TxJob2 methods, it works if I just call Complete on the DependentClones. However, if I create a scope from the clone I get a TransactionAbortedException:

void TxJob1(Transaction dt) {
    using (var tx = new TransactionScope(dt)) {
        Console.WriteLine(dtx.TransactionInformation.LocalIdentifier);
        tx.Complete();
    }
}

The exception is raised by the call to Complete in the main method, not in TxJobs. Why does this fail?

[edit] If I explicitly call Complete on the DependentTransaction in TxJobs, then it works. If I don’t call Complete on the new TransactionScope in TxJobs (triggering a rollback), then the parent transaction fails. It looks like I have to call Complete on both Transaction objects.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:26:44+00:00Added an answer on May 25, 2026 at 12:26 pm

    It looks like I have to call Complete on both the dependent clone and the TransactionScope. MS does the same in their sample code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want to populate dynamically combobox-listbox-drop-down using javascript. var table = document.createElement(table); var select =
Want to make a vocabulary list in HTML & CSS that looks like this:
want to make a comma-delimited string from a list of 3 possible attributes of
want to make values of the oject's dynamic (from user input) but I get
Want my FireFox at work to be in sync with my FireFox at my
want to know why String behaves like value type while using ==. String s1
want to have a Hyperlink-Button in a gridView in which I can display a
Want to code a key pad for an calculator. What I want to make
Want to send the text from my current vb application to the Active Window
want to make a check in my installer before starting installation if any other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.