Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2dd742a

Browse files
Add attachDotnetDebugger debug option
1 parent 8e4d1c0 commit 2dd742a

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

‎package.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@
500500
"type": "boolean",
501501
"description": "Determines whether a temporary PowerShell Integrated Console is created for each debugging session, useful for debugging PowerShell classes and binary modules. Overrides the user setting 'powershell.debugging.createTemporaryIntegratedConsole'.",
502502
"default": false
503+
},
504+
"attachDotnetDebugger": {
505+
"type": "boolean",
506+
"description": "If specified, a C# debug session will be started and attach to the new temporary PSIC. This does nothing unless createTemporaryIntegratedConsole is also specified.",
507+
"default": false
503508
}
504509
}
505510
},

‎src/features/DebugSession.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,19 @@ export class DebugSessionFeature extends LanguageClientConsumer
333333
this.tempSessionDetails = await this.tempDebugProcess.start(`DebugSession-${this.sessionCount++}`);
334334
utils.writeSessionFile(sessionFilePath, this.tempSessionDetails);
335335

336+
if (config.attachDotnetDebugger) {
337+
// Will wait until the process is started and available before attaching
338+
const pid = await this.tempDebugProcess.getPid();
339+
340+
await vscode.debug.startDebugging(undefined, {
341+
name: "Dotnet Debugger: PSIC Temporary Console",
342+
type: "coreclr",
343+
request: "attach",
344+
processId: pid
345+
});
346+
this.logger.write(`Attached dotnet debugger to process ${pid}`)
347+
}
348+
336349
} else {
337350
utils.writeSessionFile(sessionFilePath, this.sessionManager.getSessionDetails());
338351
}

‎src/process.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,17 @@ export class PowerShellProcess {
136136

137137
// Log that the PowerShell terminal process has been started
138138
this.log.write("Registering terminal PID log callback");
139-
this.consoleTerminal.processId.then((pid) => this.logTerminalPid(pid, pwshName));
140-
139+
this.consoleTerminal.processId.then((pid) =>
140+
this.logTerminalPid(pid, pwshName)
141+
);
141142
return sessionDetails;
142143
}
143144

145+
// Returns the process Id of the consoleTerminal
146+
public async getPid() {
147+
return await this.consoleTerminal.processId
148+
}
149+
144150
public showConsole(preserveFocus: boolean) {
145151
if (this.consoleTerminal) {
146152
this.consoleTerminal.show(preserveFocus);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /