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 9174335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:44:11+00:00 2026-06-17T16:44:11+00:00

At the moment, I’m doing something similar to this to integration test a library

  • 0

At the moment, I’m doing something similar to this to integration test a library that communicates with our API controllers, and so far so good, but I’ve run into a snag. In all of our other integration tests, we run the test inside an MSDTC transaction at isolation level ReadCommitted so that each one gets its own little private session with the databases and such, and at the end of each test, the transactions are rolled back. ..But that doesn’t work for these tests because the transactions are per-thread and all of the HttpClient/HttpServer methods are asynchronous, so the work is done on a different thread than the main one for that test, doesn’t have an ambient transaction to subscribe to, and goes right along and commits.

I’ve come across a few posts about how to open a TransactionScope on one thread and then create a dependent transaction to be passed to a new task via a closure, but I have no idea how to apply that to an HttpClient that’s connected to an in-memory HttpServer. I suspect I’m just not thinking about it the right way, but that’s about all I have to go on.

What would make sense/work/etc? I have full control over the creation of the HttpServer and the HttpClient that will connect to it, but I’m at a loss as to what to do with them.

UPDATE:

Some progress has been made- I wrote a message handler that can create a dependent transaction on the worker thread if Transaction.Current is populated when it gets there, and for some of my calls it is, but for others it isn’t, and I’m wondering if I may be chasing shadows – like, there’s a lot of ContinueWith around, and I think it’s executed on the calling thread (which would naturally have a transaction) if the antecedent task is already complete.

Would it be possible just to run the whole thing synchronously and carry the test’s thread all the way through? I’ve experimented some with ContinueWith’ing synchronously without much success..

  • 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-06-17T16:44:12+00:00Added an answer on June 17, 2026 at 4:44 pm

    As it turns out, the HttpClient and HttpServer weren’t spinning up background threads – rather, I had some errant Task.StartNew’s in my code that were causing the problem. Removing those got me going.

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

Sidebar

Related Questions

At the moment I have some test code that starts something like this: CheckBoxPreference
At the moment my server outputs HTML that looks something like this: <span class='tag'>music<a
At the moment I'm using this code /usr/libexec/PlistBuddy -c Set PreferenceSpecifiers:1:DefaultValue $productVersion Test/Settings.bundle/Root.plist in
At this moment I have an application that processes a file. My workflow is:
At this moment there is a very basic flash project that connects to a
At this moment, all of our reports are currently written in stored procedures. We
There is a moment in my app, that I need to force to show
for the moment the script does like this: click on the link edit the
The moment I added a unit test to my ASP.NET MVC application to test
At this moment, I am accessing my project pages like this and this formatting

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.