Home > front end >  .NET (core) 5.0: Unit testing hangs forever
.NET (core) 5.0: Unit testing hangs forever

Time:10-11

Pretty simple: no matter what framework I use (xunit, mstest, nunit) they hang forever.

output:

Determining projects to restore...
  All projects are up-to-date for restore.
  testapp -> C:\Users\beene\Documents\coding\csharp\current_projects\testapp\testapp\bin\Debug\net5.0\testapp.dll
  TestProject1 -> C:\Users\beene\Documents\coding\csharp\current_projects\testapp\TestProject1\bin\Debug\net5.0\TestProject1.dll
Test run for C:\Users\beene\Documents\coding\csharp\current_projects\testapp\TestProject1\bin\Debug\net5.0\TestProject1.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.11.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
vstest.console process failed to connect to testhost process after 300 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.

Test Run Aborted.

Rebuilding the solution yields no warnings or errors of any kind. Re-running the test produces the same problem.

And it stays there until it times out. The project is a test project, with a simple "Hello World!" console app and a simple function test to add one to a referenced integer. That is it. It's the simplest possible arrangement that reproduces this problem.

My research indicated that these frameworks do, in fact, support .net 5. I am left only with .NET itself.

Has anyone encountered this problem? If so I would greatly appreciate some assistance.

Anyone who needs more information or would like to run the offending projects can do so. I published a basic test case project to github that reproduces this issue on both of my computers. You can find it here: https://github.com/BeenEncoded/testproject

CodePudding user response:

For anyone using WireGuard or MozillaVPN: it will interfere with how dotnet connects to vstest.console...

Turn your VPN off.

  • Related