Why Visual Studio 2022 Enterprise unit tests don't work in my new Windows 11 laptop?

Carlos Colomina-Moreno 1 Reputation point
2022-10-20T10:09:17.043+00:00

Just creating an empty XUnit C# Unit test project fails miserably when trying to run or discover the tests with this error:
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.AnyCPU\ServiceHub.TestWindowStoreHost.exe process failed to connect to vstest.console process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.
at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.WaitForConnection()
at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.EnsureInitialized()
at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.DiscoverTests(IEnumerable1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Messaging.RemoteAgent.BaseTestAgentBridge.DiscoverTestsAsync(IEnumerable1 sources, String discoverySettings, RemoteTestPlatformOptions options)
at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<DiscoverTestsAsync>d__18.MoveNext()

Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
338 questions
{count} votes