diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 97e9820f6c..b339fcb3f2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -272,11 +272,11 @@ public virtual bool SetupChannel(IEnumerable sources, string? runSetting // Throw a test platform exception along with the error messages from the test if the test host exited unexpectedly // before communication was established. - ThrowOnTestHostExited(_testHostExited.IsSet); + ThrowOnTestHostExited(sources, _testHostExited.IsSet); // Throw a test platform exception stating the connection to test could not be established even after waiting // for the configure timeout period. - ThrowExceptionOnConnectionFailure(connTimeout); + ThrowExceptionOnConnectionFailure(sources, connTimeout); } // Handling special case for dotnet core projects with older test hosts. @@ -459,17 +459,17 @@ private void TestHostManagerHostExited(object? sender, HostProviderEventArgs? e) RequestSender.OnClientProcessExit(_testHostProcessStdError); } - private void ThrowOnTestHostExited(bool testHostExited) + private void ThrowOnTestHostExited(IEnumerable sources, bool testHostExited) { if (testHostExited) { // We might consider passing standard output here in case standard error is not // available because some errors don't end up in the standard error output. - throw new TestPlatformException(string.Format(CrossPlatEngineResources.TestHostExitedWithError, _testHostProcessStdError)); + throw new TestPlatformException(string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.TestHostExitedWithError, string.Join("', '", sources), _testHostProcessStdError)); } } - private void ThrowExceptionOnConnectionFailure(int connTimeout) + private void ThrowExceptionOnConnectionFailure(IEnumerable sources, int connTimeout) { // Failed to launch testhost process. var errorMsg = CrossPlatEngineResources.InitializationFailed; @@ -489,7 +489,7 @@ private void ThrowExceptionOnConnectionFailure(int connTimeout) if (!StringUtils.IsNullOrWhiteSpace(_testHostProcessStdError)) { // Testhost failed with error. - errorMsg = string.Format(CrossPlatEngineResources.TestHostExitedWithError, _testHostProcessStdError); + errorMsg = string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.TestHostExitedWithError, string.Join("', '", sources), _testHostProcessStdError); } throw new TestPlatformException(string.Format(CultureInfo.CurrentUICulture, errorMsg)); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 847038f2b9..2502dbc08d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -11,7 +11,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources { using System; using System.Reflection; - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -367,7 +368,7 @@ internal static string TesthostDiagLogOutputFile { } /// - /// Looks up a localized string similar to Testhost process exited with error: {0}. Please check the diagnostic logs for more information.. + /// Looks up a localized string similar to Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information.. /// internal static string TestHostExitedWithError { get { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx index ebbda678c9..4c4eaa72d5 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx @@ -169,7 +169,8 @@ Logging TestHost Diagnostics in file: {0} - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + {0} a source, or very rarely list of sources, {1} the output error. No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index ef003db9e6..7d8278769c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Proces testhost se ukončil s chybou: {0}. Další informace najdete v diagnostických protokolech. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Proces testhost se ukončil s chybou: {0}. Další informace najdete v diagnostických protokolech. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index 1de50e46ec..ded59894c9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Der TestHost-Prozess wurde mit folgendem Fehler beendet: {0}. Weitere Informationen finden Sie in den Diagnoseprotokollen. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Der TestHost-Prozess wurde mit folgendem Fehler beendet: {0}. Weitere Informationen finden Sie in den Diagnoseprotokollen. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 3294360d20..776c3d432b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - El proceso del host de prueba finalizó con el siguiente error: {0}. Consulte los registros de diagnóstico para obtener más información. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + El proceso del host de prueba finalizó con el siguiente error: {0}. Consulte los registros de diagnóstico para obtener más información. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index bddc3970be..004fa43660 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Le processus Testhost s'est arrêté. Erreur : {0}. Pour plus d'informations, consultez les journaux de diagnostic. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Le processus Testhost s'est arrêté. Erreur : {0}. Pour plus d'informations, consultez les journaux de diagnostic. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index 31444efa09..be2dcd0ddb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Il processo testhost è terminato con l'errore {0}. Per altre informazioni, vedere i log di diagnostica. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Il processo testhost è terminato con l'errore {0}. Per altre informazioni, vedere i log di diagnostica. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 62677da394..55789062e0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost プロセスがエラーで終了しました: {0}。詳細については、診断ログを確認してください。 - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Testhost プロセスがエラーで終了しました: {0}。詳細については、診断ログを確認してください。 + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index 20da27db90..aed45d6aaf 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 프로세스가 종료되었습니다(오류: {0}). 자세한 내용은 진단 로그를 확인하세요. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Testhost 프로세스가 종료되었습니다(오류: {0}). 자세한 내용은 진단 로그를 확인하세요. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index e10930a19e..7da5bf9915 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Zakończono proces testhost z powodu błędu: {0}. Sprawdź dzienniki diagnostyczne, aby uzyskać więcej informacji. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Zakończono proces testhost z powodu błędu: {0}. Sprawdź dzienniki diagnostyczne, aby uzyskać więcej informacji. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index fdd1b9eb20..3252c13d16 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - O processo do testhost foi encerrado com o erro: {0}. Verifique os logs de diagnóstico para obter mais informações. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + O processo do testhost foi encerrado com o erro: {0}. Verifique os logs de diagnóstico para obter mais informações. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index 3aa17963b3..3787669cf1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Процесс testhost завершился с ошибкой: {0}. Дополнительные сведения см. в журналах диагностики. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Процесс testhost завершился с ошибкой: {0}. Дополнительные сведения см. в журналах диагностики. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index 1262914f1a..3568758c06 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost işleminden şu hatayla çıkıldı: {0}. Daha fazla bilgi için lütfen tanılama günlüklerine bakın. - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Testhost işleminden şu hatayla çıkıldı: {0}. Daha fazla bilgi için lütfen tanılama günlüklerine bakın. + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf index 2cd35c2e0b..1d1078a44b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf @@ -64,9 +64,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. Testhost process exited with error: {0} - + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index b212fe2408..2f5e04f447 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 进程已退出,但出现错误: {0}。请查看诊断日志了解详细信息。 - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Testhost 进程已退出,但出现错误: {0}。请查看诊断日志了解详细信息。 + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index af27933cae..ae7f09aa86 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -78,9 +78,9 @@ - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 處理序已結束。錯誤: {0}。如需詳細資訊,請查看診斷記錄。 - + Testhost process for source(s) '{0}' exited with error: {1}. Please check the diagnostic logs for more information. + Testhost 處理序已結束。錯誤: {0}。如需詳細資訊,請查看診斷記錄。 + {0} a source, or very rarely list of sources, {1} the output error. DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 2e8ceb1b88..155db28c54 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -610,9 +610,7 @@ public bool CanExecuteCurrentRunConfiguration(string? runsettingsXml) var config = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettingsXml); var framework = config.TargetFramework; - // This is expected to be called once every run so returning a new instance every time. - return framework!.Name.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 - || framework.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0 + return framework!.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0 || framework.Name.IndexOf("net5", StringComparison.OrdinalIgnoreCase) >= 0; } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index 27f56d9d5f..fa2fe4ece4 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading; @@ -301,14 +302,25 @@ public void SetupChannelShouldThrowExceptionIfClientConnectionTimeout() } [TestMethod] - public void SetupChannelShouldThrowExceptionIfTestHostExitedBeforeConnectionIsEstablished() + public void SetupChannelShouldThrowExceptionWithOneSourceIfTestHostExitedBeforeConnectionIsEstablished() { string runsettings = "\r\n\r\n \r\n {0}\r\n \r\n"; _mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(false); _mockTestHostManager.Setup(tmh => tmh.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true)).Callback(() => _mockTestHostManager.Raise(t => t.HostExited += null, new HostProviderEventArgs("I crashed!"))); - Assert.AreEqual(string.Format(CrossPlatEngineResources.Resources.TestHostExitedWithError, "I crashed!"), Assert.ThrowsException(() => _testExecutionManager.SetupChannel(new List { "source.dll" }, runsettings)).Message); + Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.Resources.TestHostExitedWithError, "source.dll", "I crashed!"), Assert.ThrowsException(() => _testExecutionManager.SetupChannel(new List { "source.dll" }, runsettings)).Message); + } + + [TestMethod] + public void SetupChannelShouldThrowExceptionWithAllSourcesIfTestHostExitedBeforeConnectionIsEstablished() + { + string runsettings = "\r\n\r\n \r\n {0}\r\n \r\n"; + + _mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(false); + _mockTestHostManager.Setup(tmh => tmh.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true)).Callback(() => _mockTestHostManager.Raise(t => t.HostExited += null, new HostProviderEventArgs("I crashed!"))); + + Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.Resources.TestHostExitedWithError, string.Join("', '", new[] { "source1.dll", "source2.dll" }), "I crashed!"), Assert.ThrowsException(() => _testExecutionManager.SetupChannel(new List { "source1.dll", "source2.dll" }, runsettings)).Message); } [TestMethod]