mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 01:25:38 -05:00
Merge from vscode 9bc92b48d945144abb405b9e8df05e18accb9148
This commit is contained in:
@@ -33,6 +33,7 @@ import { variableSetEmitter } from 'vs/workbench/contrib/debug/browser/variables
|
||||
import { CancellationTokenSource, CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class DebugSession implements IDebugSession {
|
||||
|
||||
@@ -74,7 +75,8 @@ export class DebugSession implements IDebugSession {
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@INotificationService private readonly notificationService: INotificationService
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService
|
||||
) {
|
||||
this.id = generateUuid();
|
||||
this._options = options || {};
|
||||
@@ -83,7 +85,15 @@ export class DebugSession implements IDebugSession {
|
||||
} else {
|
||||
this.repl = (this.parentSession as DebugSession).repl;
|
||||
}
|
||||
this.repl.onDidChangeElements(() => this._onDidChangeREPLElements.fire());
|
||||
|
||||
const toDispose: IDisposable[] = [];
|
||||
toDispose.push(this.repl.onDidChangeElements(() => this._onDidChangeREPLElements.fire()));
|
||||
if (lifecycleService) {
|
||||
toDispose.push(lifecycleService.onShutdown(() => {
|
||||
this.shutdown();
|
||||
dispose(toDispose);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
@@ -213,6 +223,7 @@ export class DebugSession implements IDebugSession {
|
||||
} catch (err) {
|
||||
this.initialized = true;
|
||||
this._onDidChangeState.fire();
|
||||
this.shutdown();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -227,8 +238,12 @@ export class DebugSession implements IDebugSession {
|
||||
|
||||
// __sessionID only used for EH debugging (but we add it always for now...)
|
||||
config.__sessionId = this.getId();
|
||||
await this.raw.launchOrAttach(config);
|
||||
|
||||
try {
|
||||
await this.raw.launchOrAttach(config);
|
||||
} catch (err) {
|
||||
this.shutdown();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -892,19 +907,22 @@ export class DebugSession implements IDebugSession {
|
||||
this.rawListeners.push(this.raw.onDidExitAdapter(event => {
|
||||
this.initialized = true;
|
||||
this.model.setBreakpointSessionData(this.getId(), this.capabilities, undefined);
|
||||
this.shutdown();
|
||||
this._onDidEndAdapter.fire(event);
|
||||
}));
|
||||
}
|
||||
|
||||
shutdown(): void {
|
||||
// Disconnects and clears state. Session can be initialized again for a new connection.
|
||||
private shutdown(): void {
|
||||
dispose(this.rawListeners);
|
||||
if (this.raw) {
|
||||
this.raw.disconnect();
|
||||
this.raw.dispose();
|
||||
}
|
||||
this.raw = undefined;
|
||||
this.fetchThreadsScheduler = undefined;
|
||||
this.model.clearThreads(this.getId(), true);
|
||||
if (this.raw) {
|
||||
const raw = this.raw;
|
||||
this.raw = undefined;
|
||||
raw.disconnect();
|
||||
raw.dispose();
|
||||
}
|
||||
this._onDidChangeState.fire();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user