From 32a8a5c2abdcfdb52cbb9edb3583a9a58b09c5ba Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 7 Nov 2017 11:11:00 +0100 Subject: [PATCH] debug: process.session.root can be undefined fixes #37559 --- src/vs/workbench/parts/debug/electron-browser/debugService.ts | 4 ++-- src/vs/workbench/parts/debug/node/debugAdapter.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 8c2ce64e770..4072a3ae6ee 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -411,7 +411,7 @@ export class DebugService implements debug.IDebugService { this.toDisposeOnSessionEnd.get(session.getId()).push(session.onDidExitAdapter(event => { // 'Run without debugging' mode VSCode must terminate the extension host. More details: #3905 if (strings.equalsIgnoreCase(process.configuration.type, 'extensionhost') && this.sessionStates.get(session.getId()) === debug.State.Running && - process && this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && process.configuration.noDebug) { + process && process.session.root && process.configuration.noDebug) { this.broadcastService.broadcast({ channel: EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL, payload: [process.session.root.uri.fsPath] @@ -902,7 +902,7 @@ export class DebugService implements debug.IDebugService { watchExpressionsCount: this.model.getWatchExpressions().length, extensionName: `${adapter.extensionDescription.publisher}.${adapter.extensionDescription.name}`, isBuiltin: adapter.extensionDescription.isBuiltin, - launchJsonExists: this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && !!this.configurationService.getConfiguration('launch', { resource: root.uri }) + launchJsonExists: root && !!this.configurationService.getConfiguration('launch', { resource: root.uri }) }); }).then(() => process, (error: any) => { if (error instanceof Error && error.message === 'Canceled') { diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index 0bfdffe4fa2..4e8cf56e0e7 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -35,7 +35,7 @@ export class Adapter { public getAdapterExecutable(root: IWorkspaceFolder, verifyAgainstFS = true): TPromise { - if (this.rawAdapter.adapterExecutableCommand) { + if (this.rawAdapter.adapterExecutableCommand && root) { return this.commandService.executeCommand(this.rawAdapter.adapterExecutableCommand, root.uri.toString()).then(ad => { return this.verifyAdapterDetails(ad, verifyAgainstFS); });