Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"vstest.console process failed to connect to testhost process after 90 seconds" error #37

Open
ulrichb opened this issue Jan 18, 2020 · 11 comments
Assignees

Comments

@ulrichb
Copy link

ulrichb commented Jan 18, 2020

After updating to 1.0.18, I got the following errors in the TC run.

[11:06:38][Step 1/1] Test run for D:\BuildAgents\S004-V-BUILD02-Agent03\work\d26168de9c7a0431\src\xxxxxx.Tests.dll(.NETCoreApp,Version=v2.2)
[11:06:38][Step 1/1] Microsoft (R) Test Execution Command Line Tool Version 15.9.0
[11:06:38][Step 1/1] Copyright (c) Microsoft Corporation.  All rights reserved.
[11:06:38][Step 1/1] 
[11:06:38][Step 1/1] Starting test execution, please wait...
[11:08:08][Step 1/1] 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.
[11:08:08][Step 1/1] Test Run Aborted.

.NET Core Version: 2.2

@kertak90
Copy link

kertak90 commented Feb 10, 2020

Hi
i Have same problem.
I'm create ApiTests project with Nunit tests for custom class methods. Tests successfully run.
Then create UnitApiTestsService project which use ApiTests.dll like:

var dockerEnvironment = Environment.GetEnvironmentVariable("DOCKER_UNIT_TEST_ENVIRONMENT")=="TRUE" ? true : false;
                var info = new ProcessStartInfo
                {
                    FileName = "dotnet",
                    //Arguments = "vstest ../ApiTests/bin/Debug/netcoreapp2.2/ApiTests.dll",
                    //Arguments = "vstest ApiTests.dll",
                    Arguments = dockerEnvironment ? "vstest ApiTests.dll" : "vstest ../ApiTests/bin/Debug/netcoreapp2.2/ApiTests.dll",
                    UseShellExecute = false,
                    RedirectStandardOutput = true
                };
                _shedulerProcess = Process.Start(info);
                var testResults = _shedulerProcess.StandardOutput.ReadToEnd();
                _shedulerProcess.WaitForExit();

dockerEnvironment is true
Service runned by message from RabbitMQ. Locally all succesfully work, but when i put UnitApiTestsService in docker image, after start this image i have same throuble on line Process.Start(info); with this text:
vstest.console process failed to connect to testhost process after 10000 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout. Test Run Aborted.
when container work, service successfully receive message from Rabbit.
anybody might solve this trouble?

@NikolayPianikov NikolayPianikov self-assigned this Feb 10, 2020
@NikolayPianikov
Copy link
Contributor

NikolayPianikov commented Feb 10, 2020

@kertak90 The VSTest adapter should not impact on tests runs. Try adding the argument /Diag:[file name] to get details. Also try removing the adapter and repeat tests run without it.

@txs-lars
Copy link

i have the same problem.
With version 1.0.17 it works!

@ulrichb
Copy link
Author

ulrichb commented Mar 18, 2020

My observation:

  • With 1.0.17: test runs fine

  • After removing the TeamCity.VSTest.TestAdapter package ref + clean build: test runs fine

  • After adding TeamCity.VSTest.TestAdapter v1.0.20:

    Error with 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.

    BUT: The output appears immediately (no 90 secs. wait). Also set VSTEST_CONNECTION_TIMEOUT=1000 makes no difference.

    --diag output (censored)

@NikolayPianikov
Copy link
Contributor

I found a potential problem in the attached log:

TpTrace Warning: 0 : 15152, 6, 2020/03/18, 13:10:47.296, 889890365818, vstest.console.dll, ProxyOperationManager: Failed to end session: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.EndSession() at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.Close()

Unfortunately cannot reproduce. Can someone share a minimal test project to reproduce?

@ulrichb
Copy link
Author

ulrichb commented Mar 19, 2020

Can someone share a minimal test project to reproduce?

.. I will try.

Is it possible that the problem is that I'm using .NET Core 2.2? I'm asking because one of the changes of 1.0.18 is this dependencies update: b1d1a6c ... where Microsoft.NET.Test.Sdk changed from version 15 to 16.

@txs-lars: Do you also use .NET Core 2.x?

@txs-lars
Copy link

Can someone share a minimal test project to reproduce?

.. I will try.

Is it possible that the problem is that I'm using .NET Core 2.2? I'm asking because one of the changes of 1.0.18 is this dependencies update: b1d1a6c ... where Microsoft.NET.Test.Sdk changed from version 15 to 16.

@txs-lars: Do you also use .NET Core 2.x?

I use .Net Core 3.1

@viganella
Copy link

viganella commented Apr 9, 2020

I get the same Error both in VS2019 and VS2017, across all solutions when trying to run tests.
Tried to change Platform target(x64) as per some suggestions, clear cache, add MSTest.TestFramework nuget, yada yada yada. Nothing worked.

Log level is set to Informational (Default). Test data store opened in 0,016 sec. [2020-04-08 5:30:27.824 ] ---------- Discovery started ---------- Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.InitializeExtensions(IEnumerable1 pathToAdditionalExtensions)
at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.d__52.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.TestWindow.Extensibility.ILoggerExtensions.d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[2020-04-08 5:30:31.848 ] ---------- Discovery started ----------
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.Host.TestPlatformProvider.<>c__DisplayClass44_0.<<DiscoverTestsAsync>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [2020-04-08 5:32:02.038 ] ========== Discovery aborted: 0 tests found (0:01:30,1171667) ========== [2020-04-08 5:32:02.137 ] ---------- Run started ---------- Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.RunTests(IEnumerable1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler)
at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler)
at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>c__DisplayClass50_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[2020-04-08 5:33:32.278 ] ========== Run aborted: 0 tests run (0:01:30,0827014) ==========
[2020-04-08 5:33:32.554 ] ---------- Discovery started ----------
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.Host.TestPlatformProvider.<>c__DisplayClass44_0.<<DiscoverTestsAsync>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [2020-04-08 5:35:02.580 ] ========== Discovery aborted: 0 tests found (0:01:30,0175501) ========== [2020-04-09 9:38:01.521 ] ---------- Discovery started ---------- Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.Host.TestPlatformProvider.<>c__DisplayClass44_0.<b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[2020-04-09 9:39:31.595 ] ========== Discovery aborted: 0 tests found (0:01:30,0340483) ==========
[2020-04-09 9:39:31.669 ] ---------- Run started ----------
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.RunTests(IEnumerable1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>c__DisplayClass50_0.<<RunTestsAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [2020-04-09 9:41:01.753 ] ========== Run aborted: 0 tests run (0:01:30,0331063) ========== [2020-04-09 9:42:18.392 ] ---------- Discovery started ---------- Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.Host.TestPlatformProvider.<>c__DisplayClass44_0.<b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[2020-04-09 9:43:48.470 ] ========== Discovery aborted: 0 tests found (0:01:30,0565348) ==========
[2020-04-09 9:43:48.517 ] ---------- Run started ----------
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.RunTests(IEnumerable1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>c__DisplayClass50_0.<<RunTestsAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [2020-04-09 9:45:18.556 ] ========== Run aborted: 0 tests run (0:01:30,020122) ========== [2020-04-09 9:50:23.923 ] ---------- Discovery started ---------- Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.Host.TestPlatformProvider.<>c__DisplayClass44_0.<b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[2020-04-09 9:51:53.970 ] ========== Discovery aborted: 0 tests found (0:01:30,0361902) ==========
[2020-04-09 9:51:54.032 ] ---------- Run started ----------
Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TransationLayerException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.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.RunTests(IEnumerable1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>c__DisplayClass50_0.<<RunTestsAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [2020-04-09 9:53:24.079 ] ========== Run aborted: 0 tests run (0:01:30,0128815) ==========

@NikolayPianikov
Copy link
Contributor

How did you run tests? I mean .NET TeamCity runner or scripts?

@NikolayPianikov
Copy link
Contributor

Try updating test SDK 'Microsoft.NET.Test.Sdk' to latest version for test projects

@viganella
Copy link

@NikolayPianikov Updating VS made it work, weird issue. Thanks for the comment though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants