TeamCity freezing tests for xUnit test project when a lot of tests


All projects in solution run on .NET Core 3.1.

I am running ".NET CLI (dotnet)" build step with:
1. Command: "test".
2. Configuration: "release" ("debug" not works too).

3. Command line parameters: "-p:ParallelizeTestCollections=false" (and without not works too)

I have around integration 1300 tests in one xUnit test project and they started to freezing. Identify on which test all freezes difficult because TeamCity does not show which test is running currently (last message about finished test).

What I have tried:

1. I removed all GetAwaiter().GetResult() from code.

2. Rewrote all IDisposable to IAsyncLifetime interface (from xUnit).
3. Download xUnit plugin for TeamCity. Run it in 2.4.x version (I have 2.4.1 in my project). But have an error: Console Runner v2.4.1 (64-bit Desktop .NET 4.5.2, runtime: 4.0.30319.42000)
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I suppose one of the problem that I cannot select .NET Core 3.1 in this plugin and I have to select .NET 4.5.


One thing that helped me is to split test project into 2 (with around 650 tests in each). But I don`t like this solution.
Will be appreciated for suggestions how to solve this problem?

Comment actions Permalink

Which version of teamcity and of the dotnet plugin are you running? If you are not on recent releases we would strongly recommend upgrading. In recent versions the dotnet plugin was integrated into teamcity and .NET CLI (dotnet) is not necessary anymore, you have the ".NET" runner available directly without requiring the external plugin.


If you are using an old enough version, it's possible that there is something about the .net 3.1 that needed to be fixed and was in newer releases. 


If upgrading does not help, please follow this instructions to collect the required information for us to investigate the issue and send it to us as described there:,HangingsandLowPerformance

Comment actions Permalink

We are using TeamCity 2019.1.5 (build 66605). We will try to update version.
Bu how could I run xUnit tests using ".NET process runner"? Before I run test build step, I have a location of solution and all of related project files (.csproj), and build location.

Comment actions Permalink

Problem is solved. It was deadlock in tests.Thanks for help!

Comment actions Permalink

Thanks for the follow up. As a quick clarification, I did not say ".NET process runner", but ".NET" runner. The runner is named ".NET", but is only available starting on 2019.2.3, which is why I also asked about the version.


Please sign in to leave a comment.