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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:24:29+00:00 2026-05-23T10:24:29+00:00

I have a set of Unit Tests run in parallel ( this is important,

  • 0

I have a set of Unit Tests run in parallel (this is important, it works fine if the tests are run single-threaded) which makes calls to WebClient to download a resource that consistently takes over 30 seconds to return, and this causes the Unit Test to forcefully exit with one of the following two messages:

Thread was being aborted.

The application domain in which the thread was running has been unloaded.

I have tried setting the [Timeout] attribute, various app.config settings, including even creating an EventWaitHandle to make the unit test thread wait on the WebClient thread, with no luck. I checked the Test Timeouts settings under the Test Settings, and it is set to the default of 30 minutes.


Edit 2:

As indicated by @peer, this is a known bug in the VS.Net Test Framework: http://connect.microsoft.com/VisualStudio/feedback/details/587390/threadabortexception-when-running-two-tests-in-parallel-one-taking-40-seconds

Edit:

Here is the simplest scenario which will reproduce the problem. Can you make these Unit Tests run to completion, and if so, how? These tests must be run in parallel! Start a new Visual Studio Unit Test project, and use the following settings and Test Method code. When you run, make sure they are actually running in parallel (i.e., you will need a processor with multiple cores, and check that they are running simultaneously. I have found that to get them to run in parallel, I have to apply all the settings, then close the project and re-open it again before the parallelization will apply).

Local.testsettings (add parallelTestCount="#", whatever applies to your processor):

<Description>These are default test settings for a local test run.</Description>
<Deployment enabled="false" />
<Execution parallelTestCount="4">
  <TestTypeSpecific />
  <AgentRule name="Execution Agents">
  </AgentRule>
</Execution>

TraceAndTestImpact.testsettings (comment out the DataCollectors):

<Description>These are test settings for Trace and Test Impact.</Description>
<Execution parallelTestCount="0">
  <TestTypeSpecific />
  <AgentRule name="Execution Agents">
    <!--<DataCollectors>
      <DataCollector uri="datacollector://microsoft/SystemInfo/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.SystemInfo.SystemInfoDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.SystemInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="System Information">
      </DataCollector>
      <DataCollector uri="datacollector://microsoft/HttpProxy/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.HttpProxyCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="ASP.NET Client Proxy for IntelliTrace and Test Impact">
      </DataCollector>
      <DataCollector uri="datacollector://microsoft/TestImpact/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TestImpactDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Test Impact">
      </DataCollector>
      <DataCollector uri="datacollector://microsoft/TraceDebugger/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TraceDebuggerDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="IntelliTrace">
      </DataCollector>
    </DataCollectors>-->
  </AgentRule>
</Execution>

UnitTest1.cs (first unit test, sleeps 35 seconds):

[TestMethod]
public void TestMethod1()
{
    Thread.Sleep(35000);
    // in default unit test settings, this line will never be reached
    Console.WriteLine("TestMethod1");
}

UnitTest2.cs (second unit test, sleeps 35 seconds):

[TestMethod]
public void TestMethod2()
{
    Thread.Sleep(35000);
    // in default unit test settings, this line will never be reached
    Console.WriteLine("TestMethod2");
}

If you have the parallelization correctly setup, you will find that both tests will fail, with a ThreadAbortException, with either of the two messages presented at the top. How can I tell these methods to run longer than 30 seconds??

  • 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-23T10:24:30+00:00Added an answer on May 23, 2026 at 10:24 am

    You should go to menu: Test -> Edit Test Setting -> current test config

    Go to the tab: Test Timeouts

    Change the timeout to any time you like.

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

Sidebar

Related Questions

I have set of Visual Studio solutions which have unit tests. I want to
I have a set of unit tests, which are testing a program using the
I have some unit tests set up in my PowerBuilder application that run through
I have a set of unit tests, each with a bunch of methods, each
I'm using Google Test Framework to set some unit tests. I have got three
I have a set of Visual Studio Team System unit (integration really) tests that
I have unit tests set up for my iPhone project built using the Google
I am modifying a Nant build script to run some unit tests. I have
In most framework unit testing implementations, you have a set of a tests and
So I have a set of unit/integration tests and a set of selenium rc

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.