Skip to content

Commit

Permalink
Resolve .NET Core debugging on Windows (#798)
Browse files Browse the repository at this point in the history
* Resolve windows debugging regression.

* Breakout script per platform.

* Added period.
  • Loading branch information
philliphoff authored Feb 21, 2019
1 parent d6a526a commit 0107600
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions debugging/coreclr/debuggerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { PlatformOS } from '../../utils/platform';
import { DockerClient } from './dockerClient';
import { OSProvider } from './osProvider';
import { VsDbgClient } from './vsdbgClient';

export interface DebuggerClient {
Expand All @@ -18,25 +19,36 @@ 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) {
}

public async getDebugger(os: PlatformOS, containerId: string): Promise<string> {
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);
}
}

Expand Down
1 change: 1 addition & 0 deletions debugging/coreclr/registerDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function registerDebugConfigurationProvider(ctx: vscode.ExtensionContext)
new DefaultAppStorageProvider(fileSystemProvider),
new DefaultDebuggerClient(
dockerClient,
osProvider,
new RemoteVsDbgClient(
dockerOutputManager,
fileSystemProvider,
Expand Down

0 comments on commit 0107600

Please sign in to comment.