From 7aee1128785c97272422b6982be2d78761bc9291 Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Tue, 19 Feb 2019 13:24:51 -0800 Subject: [PATCH 1/3] Resolve windows debugging regression. --- debugging/coreclr/debuggerClient.ts | 8 ++++++-- debugging/coreclr/registerDebugger.ts | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debugging/coreclr/debuggerClient.ts b/debugging/coreclr/debuggerClient.ts index b73a6c70d6..bb10aa8848 100644 --- a/debugging/coreclr/debuggerClient.ts +++ b/debugging/coreclr/debuggerClient.ts @@ -4,6 +4,7 @@ import { PlatformOS } from '../../utils/platform'; import { DockerClient } from './dockerClient'; +import { OSProvider } from './osProvider'; import { VsDbgClient } from './vsdbgClient'; export interface DebuggerClient { @@ -19,10 +20,11 @@ export class DefaultDebuggerClient { // This script determines the "type" of Linux release (e.g. 'alpine', 'debian', etc.). // NOTE: The result may contain line endings. - private static debuggerLinuxReleaseIdScript: string = '/bin/sh -c \'ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\''; + private static debuggerLinuxReleaseIdScript: string = '/bin/sh -c \"ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\"'; constructor( private readonly dockerClient: DockerClient, + private readonly osProvider: OSProvider, private readonly vsdbgClient: VsDbgClient) { } @@ -32,11 +34,13 @@ export class DefaultDebuggerClient { } else { const result = await this.dockerClient.exec(containerId, DefaultDebuggerClient.debuggerLinuxReleaseIdScript, { interactive: true }); - return await this.vsdbgClient.getVsDbgVersion( + const path = await this.vsdbgClient.getVsDbgVersion( DefaultDebuggerClient.debuggerVersion, result.trim() === 'alpine' ? DefaultDebuggerClient.debuggerLinuxAlpineRuntime : DefaultDebuggerClient.debuggerLinuxDefaultRuntime); + + return this.osProvider.pathNormalize(os, path); } } diff --git a/debugging/coreclr/registerDebugger.ts b/debugging/coreclr/registerDebugger.ts index 7001e88ba2..4737f4c8bb 100644 --- a/debugging/coreclr/registerDebugger.ts +++ b/debugging/coreclr/registerDebugger.ts @@ -39,6 +39,7 @@ export function registerDebugConfigurationProvider(ctx: vscode.ExtensionContext) new DefaultAppStorageProvider(fileSystemProvider), new DefaultDebuggerClient( dockerClient, + osProvider, new RemoteVsDbgClient( dockerOutputManager, fileSystemProvider, From 610912ed9ed42df8cafe8fd0b89db6bb6174924e Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Tue, 19 Feb 2019 14:47:58 -0800 Subject: [PATCH 2/3] Breakout script per platform. --- debugging/coreclr/debuggerClient.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/debugging/coreclr/debuggerClient.ts b/debugging/coreclr/debuggerClient.ts index bb10aa8848..140ed5373d 100644 --- a/debugging/coreclr/debuggerClient.ts +++ b/debugging/coreclr/debuggerClient.ts @@ -19,8 +19,11 @@ export class DefaultDebuggerClient { private static debuggerWindowsRuntime: string = 'win7-x64'; // This script determines the "type" of Linux release (e.g. 'alpine', 'debian', etc.). - // NOTE: The result may contain line endings. - private static debuggerLinuxReleaseIdScript: string = '/bin/sh -c \"ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\"'; + // NOTES: + // - The result may contain line endings. + // - Windows seems to insist on double quotes + private static debuggerLinuxReleaseIdScript: string = '/bin/sh -c \'ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\''; + private static debuggerLinuxReleaseIdScriptOnWindows: string = '/bin/sh -c \"ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\"'; constructor( private readonly dockerClient: DockerClient, @@ -32,7 +35,12 @@ export class DefaultDebuggerClient { if (os === 'Windows') { return await this.vsdbgClient.getVsDbgVersion(DefaultDebuggerClient.debuggerVersion, DefaultDebuggerClient.debuggerWindowsRuntime); } else { - const result = await this.dockerClient.exec(containerId, DefaultDebuggerClient.debuggerLinuxReleaseIdScript, { interactive: true }); + const result = await this.dockerClient.exec( + containerId, + this.osProvider.os === 'Windows' + ? DefaultDebuggerClient.debuggerLinuxReleaseIdScriptOnWindows + : DefaultDebuggerClient.debuggerLinuxReleaseIdScript, + { interactive: true }); const path = await this.vsdbgClient.getVsDbgVersion( DefaultDebuggerClient.debuggerVersion, From c911dc2938da17d6f3eecf907362ec32353bc0cd Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Tue, 19 Feb 2019 15:04:38 -0800 Subject: [PATCH 3/3] Added period. --- debugging/coreclr/debuggerClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debugging/coreclr/debuggerClient.ts b/debugging/coreclr/debuggerClient.ts index 140ed5373d..3e4b2a4247 100644 --- a/debugging/coreclr/debuggerClient.ts +++ b/debugging/coreclr/debuggerClient.ts @@ -21,7 +21,7 @@ export class DefaultDebuggerClient { // This script determines the "type" of Linux release (e.g. 'alpine', 'debian', etc.). // NOTES: // - The result may contain line endings. - // - Windows seems to insist on double quotes + // - Windows seems to insist on double quotes. private static debuggerLinuxReleaseIdScript: string = '/bin/sh -c \'ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\''; private static debuggerLinuxReleaseIdScriptOnWindows: string = '/bin/sh -c \"ID=default; if [ -e /etc/os-release ]; then . /etc/os-release; fi; echo $ID\"';