Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve .NET Core debugging on Windows #798

Merged
merged 3 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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