Skip to content

Commit f709269

Browse files
rkeithhilldaviwil
authored andcommitted
Give better error msg when attach to process w/PS Core
The current approach spits out a message in the terminal about a missing wincore pkg.
1 parent bd9f012 commit f709269

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/features/DebugSession.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export class DebugSessionFeature implements IFeature {
4848
var settings = Settings.load();
4949
let createNewIntegratedConsole = settings.debugging.createTemporaryIntegratedConsole;
5050

51+
if (config.request === "attach") {
52+
let versionDetails = this.sessionManager.getPowerShellVersionDetais();
53+
if (versionDetails.edition.toLowerCase() === "core") {
54+
vscode.window.showErrorMessage("PowerShell Core does not support attaching to a PowerShell host process.");
55+
return;
56+
}
57+
}
58+
5159
if (generateLaunchConfig) {
5260
// No launch.json, create the default configuration for both unsaved (Untitled) and saved documents.
5361
config.type = 'PowerShell';

src/session.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ export class SessionManager implements Middleware {
217217
return this.sessionDetails;
218218
}
219219

220+
public getPowerShellVersionDetais() : PowerShellVersionDetails {
221+
return this.versionDetails;
222+
}
223+
220224
public dispose() : void {
221225
// Stop the current session
222226
this.stop();

0 commit comments

Comments
 (0)