diff --git a/debugging/coreclr/debuggerClient.ts b/debugging/coreclr/debuggerClient.ts index b73a6c70d6..3e4b2a4247 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 { @@ -18,11 +19,15 @@ 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. + // 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, + private readonly osProvider: OSProvider, private readonly vsdbgClient: VsDbgClient) { } @@ -30,13 +35,20 @@ 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 }); - - return await this.vsdbgClient.getVsDbgVersion( + 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, 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,