From cdd41d2a1eafd0996359a6eb7693398628df059c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 7 Jul 2025 10:20:41 +0200 Subject: [PATCH 1/2] dump-logs? --- .../CustomTestHostTests.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs index 9996f086e0..3c5ed936ac 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs @@ -1,9 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; +using System.IO; using System.Linq; +using System.Text; using System.Threading; using FluentAssertions; @@ -158,6 +162,27 @@ public void RunAllTestsWithMixedTFMsWillProvideAdditionalInformationToTheDebugge vstestConsoleWrapper.RunTestsWithCustomTestHost(new[] { netFrameworkDll, netDll }, runsettingsXml, runEventHandler, testHostLauncher); // Assert + if (runEventHandler.Errors.Any()) + { + var tempPath = TempDirectory.Path; + var files = System.IO.Directory.GetFiles(tempPath, "*.txt").ToList(); + if (files.Count == 0) + { + throw new InvalidOperationException($"No error files found in {tempPath}. {string.Join("\n", Directory.GetFiles(tempPath))}"); + } + + var allText = new StringBuilder(); + foreach (var file in files) + { +#pragma warning disable CA1305 // Specify IFormatProvider + allText.AppendLine($"Error file: {file}"); + allText.AppendLine(File.ReadAllText(file)); + allText.AppendLine(); +#pragma warning restore CA1305 // Specify IFormatProvider + } + throw new InvalidOperationException($"Logs: {allText}"); + } + runEventHandler.Errors.Should().BeEmpty(); testHostLauncher.AttachDebuggerInfos.Should().HaveCount(2); var targetFrameworks = testHostLauncher.AttachDebuggerInfos.Select(i => i.TargetFramework).ToList(); From fbdaed6e40bebb6051d2d85b6da58e59921620ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 7 Jul 2025 11:15:49 +0200 Subject: [PATCH 2/2] using --- .../TranslationLayerTests/CustomTestHostTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs index 3c5ed936ac..b1d399e20a 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Text;