From 66e129c699dfae206f451014d7218935d49e47e8 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Thu, 20 Oct 2022 16:24:47 -0500 Subject: [PATCH] Respect a path in MSBuildDebugEngine --- src/Shared/Debugging/DebugUtils.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Shared/Debugging/DebugUtils.cs b/src/Shared/Debugging/DebugUtils.cs index 3ae6cf16891..1aa30656305 100644 --- a/src/Shared/Debugging/DebugUtils.cs +++ b/src/Shared/Debugging/DebugUtils.cs @@ -28,6 +28,16 @@ static DebugUtils() if (Traits.Instance.DebugEngine) { + string debugEngineValue = FileUtilities.TrimAndStripAnyQuotes(Environment.GetEnvironmentVariable("MSBuildDebugEngine")); + + if (string.IsNullOrWhiteSpace(debugDirectory) + && !string.IsNullOrWhiteSpace(debugEngineValue) + && Path.IsPathRooted(debugEngineValue)) + { + // DebugEngine value is a path, so use it as the directory, unless DEBUGPATH was set. + debugDirectory = debugEngineValue; + } + if (!string.IsNullOrWhiteSpace(debugDirectory) && FileUtilities.CanWriteToDirectory(debugDirectory)) { // Debug directory is writable; no need for fallbacks