From fad09b47be4fc8a3cb85e5ba3263675b4efb86c9 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Mon, 22 Aug 2022 15:59:35 +0200 Subject: [PATCH 1/5] improve VSTEST_DUMP_PROCDUMPARGUMENTS --- TestPlatform.sln | 1 + .../Properties/AssemblyInfo.cs | 1 + .../BlameCollector.cs | 3 +++ ...crosoft.TestPlatform.Extensions.BlameDataCollector.csproj | 1 + .../ProcDumpArgsBuilder.cs | 5 ++++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/TestPlatform.sln b/TestPlatform.sln index 1df385fcd8..b0c2ff838c 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -539,6 +539,7 @@ Global src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{27dfbd04-64b2-4f1b-82b2-006620cca6f8}*SharedItemsImports = 5 src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{2c7ce1f8-e73e-4987-8023-b5a0ebac86e8}*SharedItemsImports = 5 src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{71cb42ff-e750-4a3b-9c3a-ac938853cc89}*SharedItemsImports = 5 + src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{76d4bb7e-d981-42d5-be96-6fad8def9a4a}*SharedItemsImports = 5 src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{7f26eda3-c8c4-4b7f-a9b6-d278c2f40a13}*SharedItemsImports = 13 EndGlobalSection EndGlobal diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs index 5d2a47c108..66b8c59103 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs @@ -31,6 +31,7 @@ [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] #if !NETSTANDARD1_0 // The following GUID is for the ID of the typelib if this project is exposed to COM diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs index a31eabcd05..17ac2ebb50 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Xml; +using Microsoft.VisualStudio.TestPlatform.Execution; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.Utilities; @@ -118,6 +119,8 @@ public override void Initialize( DataCollectionLogger logger, DataCollectionEnvironmentContext? environmentContext) { + DebuggerBreakpoint.WaitForDebugger("VSTEST_BLAMEDATACOLLECTOR_DEBUG"); + _events = events; _dataCollectionSink = dataSink; _context = environmentContext; diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj index 54847933a7..bd264589db 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj @@ -12,6 +12,7 @@ $(MSBuildWarningsAsMessages);MSB3270;MSB3276 ..\..\ + Microsoft.TestPlatform.Extensions.BlameDataCollector diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs index 5d5f07fecd..b870d06829 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs @@ -42,7 +42,10 @@ public string BuildTriggerBasedProcDumpArgs(int processId, string filename, IEnu } procDumpArgument.Append($"{processId} {filename}.dmp"); - var argument = procdumpArgumentsFromEnv.IsNullOrWhiteSpace() ? procDumpArgument.ToString() : procdumpArgumentsFromEnv; + var argument = procdumpArgumentsFromEnv.IsNullOrWhiteSpace() + ? procDumpArgument.ToString() + : $"-accepteula {procdumpArgumentsFromEnv} {processId} {filename}.dmp"; + if (!argument.ToUpperInvariant().Contains("-accepteula".ToUpperInvariant())) { argument = $"-accepteula {argument}"; From 7012bb2abfbe68041fe6e5b6fbdbb3a8398ab723 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Mon, 22 Aug 2022 17:05:13 +0200 Subject: [PATCH 2/5] fix build --- .../Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj index bd264589db..381466d689 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj @@ -28,7 +28,6 @@ - From c07d628d585f57c73434ae64bde3006b439ffe14 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Mon, 22 Aug 2022 18:40:14 +0200 Subject: [PATCH 3/5] add unit test --- .../Properties/AssemblyInfo.cs | 1 + .../ProcDumpArgsBuilder.cs | 16 ++++++++++++++-- .../ProcDumpArgsBuilderTests.cs | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs index 66b8c59103..8e8e6a8062 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs @@ -32,6 +32,7 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] #if !NETSTANDARD1_0 // The following GUID is for the ID of the typelib if this project is exposed to COM diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs index b870d06829..34b24548c4 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpArgsBuilder.cs @@ -5,10 +5,22 @@ using System.Collections.Generic; using System.Text; +using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; +using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + namespace Microsoft.TestPlatform.Extensions.BlameDataCollector; public class ProcDumpArgsBuilder : IProcDumpArgsBuilder { + private readonly IEnvironmentVariableHelper _environmentVariableHelper; + + public ProcDumpArgsBuilder() : this(new EnvironmentVariableHelper()) { } + + internal ProcDumpArgsBuilder(IEnvironmentVariableHelper environmentVariableHelper) + { + _environmentVariableHelper = environmentVariableHelper ?? throw new ArgumentNullException(nameof(environmentVariableHelper)); + } + /// public string BuildTriggerBasedProcDumpArgs(int processId, string filename, IEnumerable procDumpExceptionsList, bool isFullDump) { @@ -26,10 +38,10 @@ public string BuildTriggerBasedProcDumpArgs(int processId, string filename, IEnu // Filter the first chance exceptions only to those that are most likely to kill the whole process. // Fully override parameters to procdump - var procdumpArgumentsFromEnv = Environment.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPARGUMENTS")?.Trim(); + var procdumpArgumentsFromEnv = _environmentVariableHelper.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPARGUMENTS")?.Trim(); // Useful additional arguments are -n 100, to collect all dumps that you can, or -o to overwrite dump, or -f EXCEPTION_NAME to add exception to filter list - var procdumpAdditonalArgumentsFromEnv = Environment.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPADDITIONALARGUMENTS")?.Trim(); + var procdumpAdditonalArgumentsFromEnv = _environmentVariableHelper.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPADDITIONALARGUMENTS")?.Trim(); StringBuilder procDumpArgument = new($"-accepteula -e 1 -g -t {procdumpAdditonalArgumentsFromEnv}"); if (isFullDump) { diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs index 8c7c9af632..38ba9a5f91 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; +using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; + namespace Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests; [TestClass] @@ -54,4 +57,15 @@ public void BuildTriggerProcDumpArgsWithAlwaysCollectShouldCreateCorrectArgStrin // adds -t for collect on every process exit Assert.AreEqual("-accepteula -e 1 -g -t -ma -f a -f b 1234 dump.dmp", argString); } + + [TestMethod] + public void BuildTriggerProcDumpArgsWith_VSTEST_DUMP_PROCDUMPARGUMENTS_EnvironmentVariables() + { + Mock environmentVariableHelper = new(); + environmentVariableHelper.Setup(e => e.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPARGUMENTS")).Returns("-e 1 -g -t -ma"); + + var procDumpArgsBuilder = new ProcDumpArgsBuilder(environmentVariableHelper.Object); + var argString = procDumpArgsBuilder.BuildTriggerBasedProcDumpArgs(_defaultProcId, _defaultDumpFileName, new List { "a", "b" }, true); + Assert.AreEqual("-accepteula -e 1 -g -t -ma 1234 dump.dmp", argString); + } } From f99e18b8a8b7016367243591ccd98f79340bf93c Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Mon, 22 Aug 2022 18:41:13 +0200 Subject: [PATCH 4/5] fix test naming --- .../ProcDumpArgsBuilderTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs index 38ba9a5f91..424f25074c 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcDumpArgsBuilderTests.cs @@ -59,7 +59,7 @@ public void BuildTriggerProcDumpArgsWithAlwaysCollectShouldCreateCorrectArgStrin } [TestMethod] - public void BuildTriggerProcDumpArgsWith_VSTEST_DUMP_PROCDUMPARGUMENTS_EnvironmentVariables() + public void BuildTriggerProcDumpArgsWith_VSTEST_DUMP_PROCDUMPARGUMENTS_EnvironmentVariable() { Mock environmentVariableHelper = new(); environmentVariableHelper.Setup(e => e.GetEnvironmentVariable("VSTEST_DUMP_PROCDUMPARGUMENTS")).Returns("-e 1 -g -t -ma"); From 502cfe4311ba4b90307ab2906ef01e2c0ed492d6 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Mon, 22 Aug 2022 19:04:51 +0200 Subject: [PATCH 5/5] move to consts --- ...osoft.TestPlatform.Execution.Shared.projitems | 1 + .../WellKnownDebugEnvironmentVariables.cs | 16 ++++++++++++++++ .../BlameCollector.cs | 2 +- src/datacollector/DataCollectorMain.cs | 4 ++-- src/testhost.x86/Program.cs | 6 +++--- src/vstest.console/CommandLine/Executor.cs | 4 ++-- 6 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs diff --git a/src/Microsoft.TestPlatform.Execution.Shared/Microsoft.TestPlatform.Execution.Shared.projitems b/src/Microsoft.TestPlatform.Execution.Shared/Microsoft.TestPlatform.Execution.Shared.projitems index 87265cabe2..de0ddc3ab4 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/Microsoft.TestPlatform.Execution.Shared.projitems +++ b/src/Microsoft.TestPlatform.Execution.Shared/Microsoft.TestPlatform.Execution.Shared.projitems @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs b/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs new file mode 100644 index 0000000000..83402bceb7 --- /dev/null +++ b/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.Execution; + +internal static class WellKnownDebugEnvironmentVariables +{ + public const string VSTEST_BLAMEDATACOLLECTOR_DEBUG = nameof(VSTEST_BLAMEDATACOLLECTOR_DEBUG); + public const string VSTEST_DATACOLLECTOR_DEBUG = nameof(VSTEST_DATACOLLECTOR_DEBUG); + public const string VSTEST_HOST_DEBUG = nameof(VSTEST_HOST_DEBUG); + public const string VSTEST_RUNNER_DEBUG = nameof(VSTEST_RUNNER_DEBUG); + public const string VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS = nameof(VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS); + public const string VSTEST_HOST_DEBUG_ATTACHVS = nameof(VSTEST_HOST_DEBUG_ATTACHVS); + public const string VSTEST_RUNNER_DEBUG_ATTACHVS = nameof(VSTEST_RUNNER_DEBUG_ATTACHVS); + public const string VSTEST_HOST_NATIVE_DEBUG = nameof(VSTEST_HOST_NATIVE_DEBUG); +} diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs index 17ac2ebb50..2125f418fb 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs @@ -119,7 +119,7 @@ public override void Initialize( DataCollectionLogger logger, DataCollectionEnvironmentContext? environmentContext) { - DebuggerBreakpoint.WaitForDebugger("VSTEST_BLAMEDATACOLLECTOR_DEBUG"); + DebuggerBreakpoint.WaitForDebugger(WellKnownDebugEnvironmentVariables.VSTEST_BLAMEDATACOLLECTOR_DEBUG); _events = events; _dataCollectionSink = dataSink; diff --git a/src/datacollector/DataCollectorMain.cs b/src/datacollector/DataCollectorMain.cs index 89b77bd4b5..a867bde716 100644 --- a/src/datacollector/DataCollectorMain.cs +++ b/src/datacollector/DataCollectorMain.cs @@ -73,8 +73,8 @@ internal DataCollectorMain(IProcessHelper processHelper, IEnvironment environmen public void Run(string[]? args) { - DebuggerBreakpoint.AttachVisualStudioDebugger("VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS"); - DebuggerBreakpoint.WaitForDebugger("VSTEST_DATACOLLECTOR_DEBUG"); + DebuggerBreakpoint.AttachVisualStudioDebugger(WellKnownDebugEnvironmentVariables.VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS); + DebuggerBreakpoint.WaitForDebugger(WellKnownDebugEnvironmentVariables.VSTEST_DATACOLLECTOR_DEBUG); var argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(args); diff --git a/src/testhost.x86/Program.cs b/src/testhost.x86/Program.cs index 45ece75b42..7c5c414220 100644 --- a/src/testhost.x86/Program.cs +++ b/src/testhost.x86/Program.cs @@ -55,9 +55,9 @@ public static void Main(string[]? args) internal static void Run(string[]? args, UiLanguageOverride uiLanguageOverride) { - DebuggerBreakpoint.AttachVisualStudioDebugger("VSTEST_HOST_DEBUG_ATTACHVS"); - DebuggerBreakpoint.WaitForNativeDebugger("VSTEST_HOST_NATIVE_DEBUG"); - DebuggerBreakpoint.WaitForDebugger("VSTEST_HOST_DEBUG"); + DebuggerBreakpoint.AttachVisualStudioDebugger(WellKnownDebugEnvironmentVariables.VSTEST_HOST_DEBUG_ATTACHVS); + DebuggerBreakpoint.WaitForNativeDebugger(WellKnownDebugEnvironmentVariables.VSTEST_HOST_NATIVE_DEBUG); + DebuggerBreakpoint.WaitForDebugger(WellKnownDebugEnvironmentVariables.VSTEST_HOST_DEBUG); uiLanguageOverride.SetCultureSpecifiedByUser(); var argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(args); diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index a898554a7d..28f574d161 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -83,8 +83,8 @@ internal class Executor internal Executor(IOutput output, ITestPlatformEventSource testPlatformEventSource, IProcessHelper processHelper, IEnvironment environment) { - DebuggerBreakpoint.AttachVisualStudioDebugger("VSTEST_RUNNER_DEBUG_ATTACHVS"); - DebuggerBreakpoint.WaitForDebugger("VSTEST_RUNNER_DEBUG"); + DebuggerBreakpoint.AttachVisualStudioDebugger(WellKnownDebugEnvironmentVariables.VSTEST_RUNNER_DEBUG_ATTACHVS); + DebuggerBreakpoint.WaitForDebugger(WellKnownDebugEnvironmentVariables.VSTEST_RUNNER_DEBUG); Output = output; _testPlatformEventSource = testPlatformEventSource;