From ecaaee1fdd9046c6d8ddec467777a0f4ff8a3624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 21 Jul 2022 16:05:58 +0200 Subject: [PATCH] More updates --- TestPlatform.sln | 12 ++++++++++++ .../TestPlatform.cs | 1 - .../DebuggerBreakpoint.cs | 19 +------------------ .../Hosting/DotnetTestHostManager.cs | 3 --- .../BlameDataCollectorTests.cs | 8 -------- 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/TestPlatform.sln b/TestPlatform.sln index 617d61d258..e8466c8e48 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -934,6 +934,18 @@ Global {62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x64.Build.0 = Release|Any CPU {62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x86.ActiveCfg = Release|Any CPU {62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x86.Build.0 = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|x64.ActiveCfg = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|x64.Build.0 = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|x86.ActiveCfg = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Debug|x86.Build.0 = Debug|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|Any CPU.Build.0 = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|x64.ActiveCfg = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|x64.Build.0 = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|x86.ActiveCfg = Release|Any CPU + {4DA57968-F547-4019-8381-03A218B6C385}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 6e36e73956..39100ed5ad 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -7,7 +7,6 @@ using System.IO; using System.Linq; using System.Reflection; -using System.Reflection.Metadata; using Microsoft.VisualStudio.TestPlatform.Client.Discovery; using Microsoft.VisualStudio.TestPlatform.Client.Execution; diff --git a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs index 13bf3e90d9..3d859427df 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs +++ b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs @@ -18,9 +18,6 @@ internal static class DebuggerBreakpoint { internal static void AttachVisualStudioDebugger(string environmentVariable) { -#if NETCOREAPP1_0 - return; -#else if (string.IsNullOrWhiteSpace(environmentVariable)) { throw new ArgumentException($"'{nameof(environmentVariable)}' cannot be null or whitespace.", nameof(environmentVariable)); @@ -53,14 +50,10 @@ internal static void AttachVisualStudioDebugger(string environmentVariable) Break(); } -#endif } private static bool AttachVs(Process process, int? vsPid) { -#if NETCOREAPP1_0 - return false; -#else // The way we attach VS is not compatible with .NET Core 2.1 and .NET Core 3.1, but works in .NET Framework and .NET. // We could call the library code directly here for .NET, and .NET Framework, but then we would also need to package it // together with testhost. So instead we always run the executable, and pass path to it using env variable. @@ -84,15 +77,10 @@ private static bool AttachVs(Process process, int? vsPid) attachVsProcess.WaitForExit(); return attachVsProcess.ExitCode == 0; -#endif } private static string? FindAttachVs() { -#if NETCOREAPP1_0 - return null; -#else - var fromPath = FindOnPath("AttachVS.exe"); if (fromPath != null) { @@ -100,13 +88,9 @@ private static bool AttachVs(Process process, int? vsPid) } -# if NETCOREAPP - var parent = AppContext.BaseDirectory; -#else // Don't use current process MainModule here, it resolves to dotnet if you invoke // dotnet vstest.console.dll, or dotnet testhost.dll. Use the entry assembly instead. - var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); -#endif + var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location); while (parent != null) { var path = Path.Combine(parent, @"src\AttachVS\bin\Debug\net472\AttachVS.exe"); @@ -120,7 +104,6 @@ private static bool AttachVs(Process process, int? vsPid) } return parent; -#endif } private static string? FindOnPath(string exeName) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index c08e5f6494..9bcf3ef160 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -264,9 +264,6 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( bool testHostExeFound = false; if (!useCustomDotnetHostpath && _platformEnvironment.OperatingSystem.Equals(PlatformOperatingSystem.Windows) - // REVIEW ME: @Marco Do we need to update the logic? - // testhost*.exe are build for netcoreapp2.1 and are not able to search for the correct runtime in case of - // x64/x86 on arm because the new logic (registry lookup) was added in since netcoreapp3.0. // On arm we cannot rely on apphost and we'll use dotnet.exe muxer. && !IsWinOnArm()) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs index e92f6aada1..60b31fe970 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs @@ -40,8 +40,6 @@ public BlameDataCollectorTests() } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -58,8 +56,6 @@ public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInf } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -84,8 +80,6 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo) } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -110,8 +104,6 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource]