diff --git a/package.json b/package.json index 5546cde4f..e34bd7fdb 100644 --- a/package.json +++ b/package.json @@ -2306,9 +2306,6 @@ "pipeTransport": { "description": "%generateOptionsSchema.pipeTransport.description%", "type": "object", - "required": [ - "debuggerPath" - ], "default": { "pipeCwd": "${workspaceFolder}", "pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'", @@ -2838,9 +2835,6 @@ "pipeTransport": { "description": "%generateOptionsSchema.pipeTransport.description%", "type": "object", - "required": [ - "debuggerPath" - ], "default": { "pipeCwd": "${workspaceFolder}", "pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'", @@ -3646,9 +3640,6 @@ "pipeTransport": { "description": "%generateOptionsSchema.pipeTransport.description%", "type": "object", - "required": [ - "debuggerPath" - ], "default": { "pipeCwd": "${workspaceFolder}", "pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'", @@ -4178,9 +4169,6 @@ "pipeTransport": { "description": "%generateOptionsSchema.pipeTransport.description%", "type": "object", - "required": [ - "debuggerPath" - ], "default": { "pipeCwd": "${workspaceFolder}", "pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'", diff --git a/src/coreclrDebug/activate.ts b/src/coreclrDebug/activate.ts index 36e65c701..f8cb10f71 100644 --- a/src/coreclrDebug/activate.ts +++ b/src/coreclrDebug/activate.ts @@ -283,28 +283,14 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip // debugger has finished installation, kick off our debugger process // use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session) - if (!executable) { - const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths); - const pipeTransport = _session.configuration.pipeTransport; - let command = ''; - let args = ['--interpreter=vscode']; - if (typeof pipeTransport === 'object') { - command = pipeTransport.debuggerPath; - args = pipeTransport.pipeArgs; - } else { - command = path.join( - common.getExtensionPath(), - '.debugger', - 'netcoredbg', - 'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension() - ); - } - + const pipeTransport = _session.configuration.pipeTransport; + if (!executable || typeof pipeTransport === 'object') { // Look to see if DOTNET_ROOT is set, then use dotnet cli path + const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths); const dotnetRoot: string = process.env.DOTNET_ROOT ?? (dotNetInfo.CliPath ? path.dirname(dotNetInfo.CliPath) : ''); - let options: vscode.DebugAdapterExecutableOptions | undefined = undefined; + let options: vscode.DebugAdapterExecutableOptions = {}; if (dotnetRoot) { options = { env: { @@ -313,6 +299,43 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip }; } + let command = ''; + let args = []; + if (typeof pipeTransport === 'object') { + if (pipeTransport.debuggerPath) { + command = pipeTransport.debuggerPath; + } else { + command = path.join( + common.getExtensionPath(), + '.debugger', + 'netcoredbg', + 'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension() + ); + } + if (pipeTransport.debuggerArgs) { + args = pipeTransport.debuggerArgs; + } else { + args.push('--interpreter=vscode', '--'); + } + if (pipeTransport.pipeProgram) { + args.push(pipeTransport.pipeProgram); + } + if (pipeTransport.pipeArgs) { + args.push(pipeTransport.pipeArgs); + } + if (pipeTransport.pipeCwd) { + options.cwd = pipeTransport.pipeCwd; + } + } else { + command = path.join( + common.getExtensionPath(), + '.debugger', + 'netcoredbg', + 'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension() + ); + args = ['--interpreter=vscode']; + } + executable = new vscode.DebugAdapterExecutable(command, args, options); }