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

  • Home
  • SEARCH
  • 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 208689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:50:54+00:00 2026-05-11T17:50:54+00:00

I have some code using a System.Transactions.TransactionScope , that creating a new instance of

  • 0

I have some code using a System.Transactions.TransactionScope, that creating a new instance of the transaction scope simply halts the program.

There are no exceptions or messages, the program simply stops and Visual Studio returns to code editing mode. The process is completely gone. There are no exceptions, messages or events in the event viewer.

I have another test app that uses TransactionScope with no problem, so it shouldn’t be an environment issue.

I just don’t know how to get the exception detail. I’ve turned on all the “thrown” checkboxes in the Debug->Exceptions dialog within Visual Studio, hoping that VS would automatically break when the exception was thrown, but it doesn’t.

Can anyone help me get the reason for the program exiting?

EDIT: I just found something new. The TransactionScope is being created in a method running on a background thread via ThreadPool.QueueUserWorkItem. If I just call the method directly on the main application thread, this problem goes away. So now my question is “what is the problem with using TransactionScope on a threadpool thread?”. Note I’m not starting a transaction scope before invoking the new thread, it’s all within one method running on the threadpool thread.

  • 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-11T17:50:54+00:00Added an answer on May 11, 2026 at 5:50 pm

    I’ve found the problem. It was the squishy organic component that operates my computer.

    ThreadPool.QueueUserWorkItem() will start work on a threadpool thread. Which means a background thread. The code was running in a test console application, and of course I’d forgotten to put anything in Main() to stop the program exiting after it called ThreadPool.QueueUserWorkItem(). This meant that by the time I got to pressing F10 to step to the next line, the program had actually already stopped, so the debugger closed itself.

    All I did to fix it was add a call to Console.ReadKey() at the end of Program.Main() and now it all works beautifully. Note that the problem had nothing to do with System.Transactions.TransactionScope or threadpool threads. It would’ve happened no matter what line I put my breakpoint on.

    Note:
    If you’re thinking I should’ve seen a ThreadAbortException, then reading the article linked above will point out why that didn’t happen. Here’s a direct quote:

    When the runtime stops a background
    thread because the process is shutting
    down, no exception is thrown in the
    thread. However, when threads are
    stopped because the AppDomain.Unload
    method unloads the application domain,
    a ThreadAbortException is thrown in
    both foreground and background
    threads.

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

Sidebar

Ask A Question

Stats

  • Questions 128k
  • Answers 128k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you are just trying to use an icon, you… May 12, 2026 at 5:45 am
  • Editorial Team
    Editorial Team added an answer UPDATE: This question was inspiration for my article on this… May 12, 2026 at 5:45 am
  • Editorial Team
    Editorial Team added an answer I'm not sure if you're asking if a System.IO.FileStream object… May 12, 2026 at 5:45 am

Related Questions

I'm investigating using MSMQ for my team's new project but I need to know
I'm using a remote 3rd party storage solution that does not have support for
I have an NHibernate Transaction that does some work and makes a call to
I have a program in C++, using the standard socket API, running on Ubuntu

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.