From 0a65f6425eef5eec08ec5f22855785780d5b0a49 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 13 May 2020 00:10:58 +0200 Subject: [PATCH] Fixes another Debug Session tracking bug. --- extension/src/VsCodeDebugger.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extension/src/VsCodeDebugger.ts b/extension/src/VsCodeDebugger.ts index 05a68fe..ea77edb 100644 --- a/extension/src/VsCodeDebugger.ts +++ b/extension/src/VsCodeDebugger.ts @@ -14,7 +14,12 @@ export class VsCodeDebugger { public readonly onDidStartDebugSession = this._onDidStartDebugSession.asEvent(); public getDebugSession(session: DebugSession): VsCodeDebugSession { - return this.sessions.get(session)!; + let result = this.sessions.get(session); + if (!result) { + result = new VsCodeDebugSession(session); + this.sessions.set(session, result); + } + return result; } constructor() { @@ -24,15 +29,11 @@ export class VsCodeDebugger { this._onDidStartDebugSession.emit({ session: e }); }), debug.onDidTerminateDebugSession(session => { - const e = this.sessions.get(session)!; - // TODO add proper event this.sessions.delete(session); }), debug.registerDebugAdapterTrackerFactory("*", { createDebugAdapterTracker: session => { - const extendedSession = new VsCodeDebugSession(session); - this.sessions.set(session, extendedSession); - + const extendedSession = this.getDebugSession(session); return { onWillReceiveMessage: msg => { console.log(msg.type, msg.event, msg);