vstest.console process failed to connect to testhost process after 90 seconds

Viewed 736

I have been running multiple unit tests in multiple solutions for years. Now, out of seemingly nowhere, every time I try to run a unit test, I get this message in the Tests Output pane:

Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: vstest.console process failed to connect to testhost process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.

I've tried restarting VS2019, using it in Admin mode, and restarting my computer. I've tried multiple unit tests in different repos that I know worked. All fail to run. I searched around and all of the posts are older and are with people migrating from VS2017 to VS2019 and how they needed to install nuget packages. I have Microsoft.NET.Test.Sdk, MSTest.TestAdapter, MSTest.TestFramework, and coverlet.collector all installed.

Coworkers have pulled the code down and the unit tests run and work fine for them. There has to have been some update or change that is preventing this from working. This just started a few days ago.

2 Answers

My issue was caused by an update to our company's VPN. Disabling the VPN, I was able to run unit tests again. If you are running into this issue as well, it is likely caused by a VPN/firewall change.

I was getting this issue in Visual Studio 2019. I tried admin/non-admin, restarting, re-installing and upgrading to Visual Studio 2022 without success.

After playing around for a while I found that my issue was caused by split-tunnelling in ExpressVPN which I had set up to allow connections using my actual IP to an Azure SQL database.

To resolve, I disabled the split-tunnelling feature of the VPN and restarted Visual Studio.

Related