From 3a192e94d8cfecf8e0d59ba8ad738d09c57f8725 Mon Sep 17 00:00:00 2001 From: Michel Kaporin Date: Tue, 13 Jun 2017 14:55:38 +0200 Subject: [PATCH] Taking the top most available stack frame for exception widget. Resolves #27903 --- .../electron-browser/debugEditorContribution.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts index 72c5ac93ee9..e33c15a909f 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts @@ -356,19 +356,25 @@ export class DebugEditorContribution implements IDebugEditorContribution { // Toggles exception widget based on the state of the current editor model and debug stack frame const model = this.editor.getModel(); const focusedSf = this.debugService.getViewModel().focusedStackFrame; - if (!model || !focusedSf || !focusedSf.source || !focusedSf.source.available) { + const callStack = focusedSf ? focusedSf.thread.getCallStack() : null; + if (!model || !focusedSf || !callStack || callStack.length === 0) { this.closeExceptionWidget(); return; } - const callStack = focusedSf.thread.getCallStack(); - if (!callStack || callStack.length === 0) { + // First call stack frame that is available is the frame where exception has been thrown + let exceptionSf; + for (let sf of callStack) { + if (sf.source && sf.source.available) { + exceptionSf = sf; + break; + } + } + if (!exceptionSf) { this.closeExceptionWidget(); return; } - // First call stack frame is the frame where exception has been thrown - const exceptionSf = callStack[0]; const sameUri = exceptionSf.source.uri.toString() === model.uri.toString(); if (this.exceptionWidget && !sameUri) { this.closeExceptionWidget();