JetBrains / TeamCity.VSTest.TestAdapter

Apache License 2.0
30 stars 14 forks source link

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

Open ulrichb opened 4 years ago

ulrichb commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

ulrichb commented 4 years ago

My observation:

NikolayPianikov commented 4 years ago

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 commented 4 years ago

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: https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/commit/b1d1a6c22f727c753766627bf7b7ace5e96b267d ... where Microsoft.NET.Test.Sdk changed from version 15 to 16.

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

txs-lars commented 4 years ago

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 commented 4 years ago

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.d52.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.d51.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.d9.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(IEnumerable`1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass44_0.<b1>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(IEnumerable`1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass50_0.<b0>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(IEnumerable`1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass44_0.<b1>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(IEnumerable`1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass44_0.<b1>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(IEnumerable`1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass50_0.<b0>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(IEnumerable`1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass44_0.<b1>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(IEnumerable`1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass50_0.<b0>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(IEnumerable`1 sources, String discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass44_0.<b1>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(IEnumerable`1 sources, String runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.VSTestRunRequest.RunTests(IVsTestConsoleWrapper consoleWrapper, ITestRunEventsHandler runEventsHandler) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<>cDisplayClass50_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-09 9:53:24.079 ] ========== Run aborted: 0 tests run (0:01:30,0128815) ==========`

NikolayPianikov commented 4 years ago

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

NikolayPianikov commented 4 years ago

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

viganella commented 4 years ago

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