From dd3eeda92c011edc1541ec9c7431d87b2e79815d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Thu, 3 Jul 2025 15:11:10 +0200 Subject: [PATCH 1/8] Handle dotnet_root in testhost version aware way --- .../TestPlatform.Playground.csproj | 4 +- .../Hosting/DotnetTestHostManager.cs | 115 ++++++++++++++++-- 2 files changed, 105 insertions(+), 14 deletions(-) diff --git a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj index 620c160e2d..86871a7867 100644 --- a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj +++ b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj @@ -56,8 +56,8 @@ - - + + diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index a20519373b..1233b58e7c 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -513,23 +513,114 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // i.e. I've got only private install and no global installation, in this case apphost needs to use env var to locate runtime. if (testHostExeFound) { - string prefix = "VSTEST_WINAPPHOST_"; - string dotnetRootEnvName = $"{prefix}DOTNET_ROOT(x86)"; - var dotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(dotnetRootEnvName); - if (dotnetRoot is null) + // This change needs to happen first on vstest side, and then on dotnet/sdk, so prefer this approach and fallback to the old one. + // VSTEST_DOTNET_ROOT v2 + string? dotnetRootPath = _environmentVariableHelper.GetEnvironmentVariable("VSTEST_DOTNET_ROOT_PATH"); + if (!StringUtils.IsNullOrWhiteSpace(dotnetRootPath)) { - dotnetRootEnvName = $"{prefix}DOTNET_ROOT"; - dotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(dotnetRootEnvName); - } + // This is v2 of the environment variables that we are passing, we are in new dotnet sdk. So also grab the architecture. + string? dotnetRootArchitecture = _environmentVariableHelper.GetEnvironmentVariable("VSTEST_DOTNET_ROOT_ARCHITECTURE"); - if (dotnetRoot != null) - { - EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: Found '{dotnetRootEnvName}' in env variables, value '{dotnetRoot}', forwarding to '{dotnetRootEnvName.Replace(prefix, string.Empty)}'"); - startInfo.EnvironmentVariables.Add(dotnetRootEnvName.Replace(prefix, string.Empty), dotnetRoot); + if (StringUtils.IsNullOrWhiteSpace(dotnetRootArchitecture)) + { + throw new InvalidOperationException("'VSTEST_DOTNET_ROOT_PATH' and 'VSTEST_DOTNET_ROOT_ARCHITECTURE' must be both always set. If you are seeing this error, this is a bug in dotnet SDK that sets those variables."); + } + + EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: VSTEST_DOTNET_ROOT_PATH={dotnetRootPath}"); + EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: VSTEST_DOTNET_ROOT_ARCHITECTURE={dotnetRootArchitecture}"); + + // The parent process is passing to us the path in which the dotnet.exe is and is passing the architecture of the dotnet.exe, + // so if the child process (testhost) is the same architecture it can pick up that dotnet.exe location and run. This is to allow + // local installations of dotnet/sdk to work with testhost. + // + // There are 2 complications in this process: + // 1) There are differences between how .NET Apphosts are handling DOTNET_ROOT, versions pre-net6 are only looking at + // DOTNET_ROOT(x86) and then DOTNET_ROOT. This makes is really easy to set DOTNET_ROOT to point at x64 dotnet installation + // and have that picked up by x86 testhost and fail. + // Unfortunately vstest.console has to support both new (17.14+) testhosts that are built against net8, and old (pre 17.14) + // testhosts that are built using netcoreapp3.1 apphost, and so their approach to resolving DOTNET_ROOT differ. + // + // /!\ The apphost version does not align with the targeted framework (tfm), an older testhost is built against netcoreapp3.1 + // but can be used to run net8 tests. The only way to tell is the version of the testhost. + // + // netcoreapp3.1 hosts only support DOTNET_ROOT and DOTNET_ROOT(x86) env variables. + // net8 hosts, support also DOTNET_ROOT_ variables, which is what we should prefer to set the location of dotnet + // in a more architecture specific way. + // + // 2) The surrounding environment might already have the environment variables set, most likely by setting DOTNET_ROOT, which is + // a universal way of setting where the dotnet is, that works across all different architectures of the .NET apphost. + // By setting our (hopefully more specific variable) we might overwrite what user specified, and in case of DOTNET_ROOT it is probably + // preferable when we can set the DOTNET_ROOT_ variable. + var testhostDllPath = Path.ChangeExtension(startInfo.FileName, ".dll"); + var testhostVersionInfo = FileVersionInfo.GetVersionInfo(testhostDllPath); + if (testhostVersionInfo.ProductMajorPart >= 17 && testhostVersionInfo.ProductMinorPart >= 14) + { + // This is a new testhost that builds at least against net8 we should set the architecture specific DOTNET_ROOT_. + // + // We ship testhost.exe, testhost.x86.exe and testhost.arm64.exe, if the architecture is different we won't find the testhost.exe and + // won't reach this code, but let's write this in a generic way anyway, to avoid breaking if we add more variants of testhost.exe. + var environmentVariableName = $"DOTNET_ROOT_{_architecture.ToString().ToUpperInvariant()}"; + + var existingDotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(environmentVariableName); + if (!StringUtilities.IsNullOrWhiteSpace(existingDotnetRoot)) + { + // The variable is already set in the surrounding environment, don't set it, because we want to keep what user provided. + } + else + { + // Set the architecture specific variable to the environment of the process so it is picked up. + startInfo.EnvironmentVariables.Add(environmentVariableName, dotnetRootPath); + } + } + else + { + // This is an old testhost that built against netcoreapp3.1, it does not understand architecture specific DOTNET_ROOT_, we have to set it more carefully + // to avoid setting DOTNET_ROOT that points to x64 but is picked up by x86 host. + // + // Also avoid setting it if we are already getting it from the surrounding environment. + var architectureFromEnv = (Architecture)Enum.Parse(typeof(Architecture), dotnetRootArchitecture, ignoreCase: true); + if (architectureFromEnv == _architecture) + { + if (_architecture == Architecture.X86) + { + const string dotnetRootX86 = "DOTNET_ROOT(x86)"; + if (StringUtils.IsNullOrWhiteSpace(_environmentVariableHelper.GetEnvironmentVariable(dotnetRootX86))) + { + startInfo.EnvironmentVariables.Add(dotnetRootX86, dotnetRootPath); + } + } + else + { + const string dotnetRoot = "DOTNET_ROOT"; + if (StringUtils.IsNullOrWhiteSpace(_environmentVariableHelper.GetEnvironmentVariable(dotnetRoot))) + { + startInfo.EnvironmentVariables.Add(dotnetRoot, dotnetRootPath); + } + } + } + } } else { - EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: Prefix '{prefix}*' not found in env variables"); + // Fallback, can delete this once the change is in dotnet sdk. because they are always used together. + string prefix = "VSTEST_WINAPPHOST_"; + string dotnetRootEnvName = $"{prefix}DOTNET_ROOT(x86)"; + var dotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(dotnetRootEnvName); + if (dotnetRoot is null) + { + dotnetRootEnvName = $"{prefix}DOTNET_ROOT"; + dotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(dotnetRootEnvName); + } + + if (dotnetRoot != null) + { + EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: Found '{dotnetRootEnvName}' in env variables, value '{dotnetRoot}', forwarding to '{dotnetRootEnvName.Replace(prefix, string.Empty)}'"); + startInfo.EnvironmentVariables.Add(dotnetRootEnvName.Replace(prefix, string.Empty), dotnetRoot); + } + else + { + EqtTrace.Verbose($"DotnetTestHostmanager.LaunchTestHostAsync: Prefix '{prefix}*' not found in env variables"); + } } } From 2c64e599dc4a1563251b1a1e9b991e0bbcc67bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Thu, 3 Jul 2025 16:00:48 +0200 Subject: [PATCH 2/8] Fix unit tests --- .../Hosting/DotnetTestHostManager.cs | 9 +++++---- .../Hosting/DotnetTestHostManagerTests.cs | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 1233b58e7c..5845c7b3b3 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -552,13 +552,14 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // By setting our (hopefully more specific variable) we might overwrite what user specified, and in case of DOTNET_ROOT it is probably // preferable when we can set the DOTNET_ROOT_ variable. var testhostDllPath = Path.ChangeExtension(startInfo.FileName, ".dll"); - var testhostVersionInfo = FileVersionInfo.GetVersionInfo(testhostDllPath); - if (testhostVersionInfo.ProductMajorPart >= 17 && testhostVersionInfo.ProductMinorPart >= 14) + // This file check is for unit tests, we expect the file to always be there. Otherwise testhost.exe would not be able to run. + var testhostVersionInfo = _fileHelper.Exists(testhostDllPath) ? FileVersionInfo.GetVersionInfo(testhostDllPath) : null; + if (testhostVersionInfo != null && testhostVersionInfo.ProductMajorPart >= 17 && testhostVersionInfo.ProductMinorPart >= 14) { // This is a new testhost that builds at least against net8 we should set the architecture specific DOTNET_ROOT_. // - // We ship testhost.exe, testhost.x86.exe and testhost.arm64.exe, if the architecture is different we won't find the testhost.exe and - // won't reach this code, but let's write this in a generic way anyway, to avoid breaking if we add more variants of testhost.exe. + // We ship just testhost.exe and testhost.x86.exe if the architecture is different we won't find the testhost*.exe and + // won't reach this code, but let's write this in a generic way anyway, to avoid breaking if we add more variants of testhost*.exe. var environmentVariableName = $"DOTNET_ROOT_{_architecture.ToString().ToUpperInvariant()}"; var existingDotnetRoot = _environmentVariableHelper.GetEnvironmentVariable(environmentVariableName); diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 997d4741f0..2ee8d94b3a 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -86,7 +86,6 @@ public DotnetTestHostManagerTests() _mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns(DefaultDotnetPath); _mockProcessHelper.Setup(ph => ph.GetTestEngineDirectory()).Returns(DefaultDotnetPath); _mockProcessHelper.Setup(ph => ph.GetCurrentProcessArchitecture()).Returns(PlatformArchitecture.X64); - _mockEnvironmentVariable.Setup(ev => ev.GetEnvironmentVariable(It.IsAny())).Returns(Path.GetDirectoryName(DefaultDotnetPath)!); _mockFileHelper.Setup(ph => ph.Exists(_defaultTestHostPath)).Returns(true); _mockFileHelper.Setup(ph => ph.Exists(DefaultDotnetPath)).Returns(true); From 784ffff79a9ff8e02c899d76fd0b9078f822a4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 10:13:50 +0200 Subject: [PATCH 3/8] Fixes --- docs/contribute.md | 2 +- .../Hosting/DotnetTestHostManager.cs | 2 +- .../Build.cs | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/contribute.md b/docs/contribute.md index 2a5100be9d..05ba93c560 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -147,7 +147,7 @@ default, `Debug` configuration is run. If you want to run a particular test. Eg: Test Name that contains Blame in Acceptance test ```shell -> test.cmd -p accept -f net451 -filter blame +> .\test.cmd -bl -c release /p:TestRunnerAdditionalArguments="'--filter Blame'" -Integration ``` ## Deployment diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 5845c7b3b3..5a1edbeb8c 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -494,7 +494,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( args += " " + connectionInfo.ToCommandLineOptions(); - // Create a additional probing path args with Nuget.Client + // Create a additional probing path args with Nuget.Clientl // args += "--additionalprobingpath xxx" // TODO this may be required in ASP.net, requires validation diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Build.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Build.cs index 8fab97215f..8dd581b00f 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Build.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Build.cs @@ -62,7 +62,17 @@ private static void CopyAndPatchDotnet() // e.g. artifacts\tmp\.dotnet\sdk\ var sdkDirectory = Path.Combine(patchedDotnetDir, "sdk"); // e.g. artifacts\tmp\.dotnet\sdk\8.0.100-preview.6.23330.14 - var dotnetSdkDirectory = Directory.GetDirectories(sdkDirectory).Single(); + var dotnetSdkDirectories = Directory.GetDirectories(sdkDirectory); + if (dotnetSdkDirectories.Length == 0) + { + throw new InvalidOperationException($"No .NET SDK directories found in '{sdkDirectory}'."); + } + if (dotnetSdkDirectories.Length > 1) + { + throw new InvalidOperationException($"More than 1 .NET SDK directories found in '{sdkDirectory}': {string.Join(", ", dotnetSdkDirectories)}."); + } + + var dotnetSdkDirectory = dotnetSdkDirectories.Single(); DirectoryUtils.CopyDirectory(Path.Combine(packagePath, "lib", "netstandard2.0"), dotnetSdkDirectory); DirectoryUtils.CopyDirectory(Path.Combine(packagePath, "runtimes", "any", "native"), dotnetSdkDirectory); } From 2588430d943c6d8e88b169aa90a1f994e4ee9d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 10:26:17 +0200 Subject: [PATCH 4/8] Fixes --- .../VsTestConsoleRequestSender.cs | 6 ++++++ .../TranslationLayerTests/CustomTestHostTests.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index e72355cd5b..d663507425 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -1198,6 +1198,9 @@ private void SendMessageAndListenAndReportTestResults( eventHandler.HandleLogMessage( TestMessageLevel.Error, TranslationLayerResources.AbortedTestsRun); + eventHandler.HandleLogMessage( + TestMessageLevel.Error, + exception.ToString()); var completeArgs = new TestRunCompleteEventArgs( null, false, true, exception, null, null, TimeSpan.Zero); eventHandler.HandleTestRunComplete(completeArgs, null, null, null); @@ -1283,6 +1286,9 @@ private async Task SendMessageAndListenAndReportTestResultsAsync( eventHandler.HandleLogMessage( TestMessageLevel.Error, TranslationLayerResources.AbortedTestsRun); + eventHandler.HandleLogMessage( + TestMessageLevel.Error, + exception.ToString()); var completeArgs = new TestRunCompleteEventArgs( null, false, true, exception, null, null, TimeSpan.Zero); eventHandler.HandleTestRunComplete(completeArgs, null, null, null); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs index 9996f086e0..ce05fba006 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs @@ -141,6 +141,7 @@ public void RunTestsWithCustomTestHostLauncherUsesLaunchWhenGivenAnOutdatedITest [TestCategory("Windows-Review")] [TestCategory("Feature")] [RunnerCompatibilityDataSource(AfterFeature = Features.MULTI_TFM)] + // [RunnerCompatibilityDataSource("net8.0", "MostDownloaded", "net8.0")] public void RunAllTestsWithMixedTFMsWillProvideAdditionalInformationToTheDebugger(RunnerInfo runnerInfo) { // Arrange From 97f5151ef21f05208ca52976b18665f1b20334f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 11:02:25 +0200 Subject: [PATCH 5/8] Fixes --- playground/TestPlatform.Playground/Environment.cs | 4 +++- playground/TestPlatform.Playground/Program.cs | 5 ++--- .../VsTestConsoleRequestSender.cs | 10 ++-------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/playground/TestPlatform.Playground/Environment.cs b/playground/TestPlatform.Playground/Environment.cs index d7ba86c869..7490433e71 100644 --- a/playground/TestPlatform.Playground/Environment.cs +++ b/playground/TestPlatform.Playground/Environment.cs @@ -11,9 +11,11 @@ internal class EnvironmentVariables { ["VSTEST_CONNECTION_TIMEOUT"] = "999", ["VSTEST_DEBUG_NOBP"] = "1", - ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "0", + ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "1", ["VSTEST_HOST_DEBUG_ATTACHVS"] = "0", ["VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS"] = "0", + ["VSTEST_DOTNET_ROOT_PATH"] = "C:\\Program Files\\dotnet", + ["VSTEST_DOTNET_ROOT_ARCHITECTURE"] = "x64" }; } diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index 0cebf6d996..c05a719610 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -35,7 +35,6 @@ static void Main() var thisAssemblyPath = Assembly.GetEntryAssembly()!.Location; var here = Path.GetDirectoryName(thisAssemblyPath)!; - var playground = Path.GetFullPath(Path.Combine(here, "..", "..", "..", "..")); var console = Path.Combine(here, "vstest.console", "netfx", "vstest.console.exe"); @@ -88,8 +87,8 @@ static void Main() """; var sources = new[] { - Path.Combine(playground, "bin", "MSTest1", "Debug", "net472", "MSTest1.dll"), - Path.Combine(playground, "bin", "MSTest2", "Debug", "net472", "MSTest2.dll"), + @"S:\source\OldAndNewTestSdK\OldTestSdK\bin\Debug\net8.0\OldTestSdK.dll", + @"S:\source\OldAndNewTestSdK\NewTestSdk\bin\Debug\net9.0\NewTestSdk.dll", // The built in .NET projects don't now work right now in Playground, there is some conflict with Arcade. // But if you create one outside of Playground it will work. //Path.Combine(playground, "bin", "MSTest1", "Debug", "net7.0", "MSTest1.dll"), diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index d663507425..4c623ed472 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -1197,10 +1197,7 @@ private void SendMessageAndListenAndReportTestResults( EqtTrace.Error("Aborting Test Run Operation: {0}", exception); eventHandler.HandleLogMessage( TestMessageLevel.Error, - TranslationLayerResources.AbortedTestsRun); - eventHandler.HandleLogMessage( - TestMessageLevel.Error, - exception.ToString()); + TranslationLayerResources.AbortedTestsRun + " " + exception.ToString()); var completeArgs = new TestRunCompleteEventArgs( null, false, true, exception, null, null, TimeSpan.Zero); eventHandler.HandleTestRunComplete(completeArgs, null, null, null); @@ -1285,10 +1282,7 @@ private async Task SendMessageAndListenAndReportTestResultsAsync( EqtTrace.Error("Aborting Test Run Operation: {0}", exception); eventHandler.HandleLogMessage( TestMessageLevel.Error, - TranslationLayerResources.AbortedTestsRun); - eventHandler.HandleLogMessage( - TestMessageLevel.Error, - exception.ToString()); + TranslationLayerResources.AbortedTestsRun + " " + exception.ToString()); var completeArgs = new TestRunCompleteEventArgs( null, false, true, exception, null, null, TimeSpan.Zero); eventHandler.HandleTestRunComplete(completeArgs, null, null, null); From 7e9eb7edd22732dda5d389fd5fbc291cd21a9429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 17:09:34 +0200 Subject: [PATCH 6/8] Apply suggestion from @nohwnd --- .../Hosting/DotnetTestHostManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 5a1edbeb8c..5845c7b3b3 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -494,7 +494,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( args += " " + connectionInfo.ToCommandLineOptions(); - // Create a additional probing path args with Nuget.Clientl + // Create a additional probing path args with Nuget.Client // args += "--additionalprobingpath xxx" // TODO this may be required in ASP.net, requires validation From e8b177c813bfa04227396a6f72624d5f408a0a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 17:09:53 +0200 Subject: [PATCH 7/8] Apply suggestion from @nohwnd --- .../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 ce05fba006..9996f086e0 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TranslationLayerTests/CustomTestHostTests.cs @@ -141,7 +141,6 @@ public void RunTestsWithCustomTestHostLauncherUsesLaunchWhenGivenAnOutdatedITest [TestCategory("Windows-Review")] [TestCategory("Feature")] [RunnerCompatibilityDataSource(AfterFeature = Features.MULTI_TFM)] - // [RunnerCompatibilityDataSource("net8.0", "MostDownloaded", "net8.0")] public void RunAllTestsWithMixedTFMsWillProvideAdditionalInformationToTheDebugger(RunnerInfo runnerInfo) { // Arrange From df7aa8c76de41f6586b62199f0cef94e288abc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Jul 2025 17:23:11 +0200 Subject: [PATCH 8/8] Revert changes to playground --- playground/TestPlatform.Playground/Environment.cs | 4 +--- playground/TestPlatform.Playground/Program.cs | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/playground/TestPlatform.Playground/Environment.cs b/playground/TestPlatform.Playground/Environment.cs index 7490433e71..d7ba86c869 100644 --- a/playground/TestPlatform.Playground/Environment.cs +++ b/playground/TestPlatform.Playground/Environment.cs @@ -11,11 +11,9 @@ internal class EnvironmentVariables { ["VSTEST_CONNECTION_TIMEOUT"] = "999", ["VSTEST_DEBUG_NOBP"] = "1", - ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "1", + ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "0", ["VSTEST_HOST_DEBUG_ATTACHVS"] = "0", ["VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS"] = "0", - ["VSTEST_DOTNET_ROOT_PATH"] = "C:\\Program Files\\dotnet", - ["VSTEST_DOTNET_ROOT_ARCHITECTURE"] = "x64" }; } diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index c05a719610..0cebf6d996 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -35,6 +35,7 @@ static void Main() var thisAssemblyPath = Assembly.GetEntryAssembly()!.Location; var here = Path.GetDirectoryName(thisAssemblyPath)!; + var playground = Path.GetFullPath(Path.Combine(here, "..", "..", "..", "..")); var console = Path.Combine(here, "vstest.console", "netfx", "vstest.console.exe"); @@ -87,8 +88,8 @@ static void Main() """; var sources = new[] { - @"S:\source\OldAndNewTestSdK\OldTestSdK\bin\Debug\net8.0\OldTestSdK.dll", - @"S:\source\OldAndNewTestSdK\NewTestSdk\bin\Debug\net9.0\NewTestSdk.dll", + Path.Combine(playground, "bin", "MSTest1", "Debug", "net472", "MSTest1.dll"), + Path.Combine(playground, "bin", "MSTest2", "Debug", "net472", "MSTest2.dll"), // The built in .NET projects don't now work right now in Playground, there is some conflict with Arcade. // But if you create one outside of Playground it will work. //Path.Combine(playground, "bin", "MSTest1", "Debug", "net7.0", "MSTest1.dll"),