Skip to content

Commit fc7b4ad

Browse files
feedback from @rjmholt
1 parent 5162fb9 commit fc7b4ad

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.Server
2323
{
2424
public class DebugAdapter
2525
{
26+
private static Version _minVersionForCustomPipeName = new Version(6, 2);
27+
2628
private EditorSession _editorSession;
2729

2830
private bool _noDebug;
@@ -429,7 +431,7 @@ await requestContext.SendErrorAsync(
429431
}
430432
else if (customPipeNameIsSet)
431433
{
432-
if (runspaceVersion.Version.Major < 6 && runspaceVersion.Version.Minor < 2)
434+
if (runspaceVersion.Version < _minVersionForCustomPipeName)
433435
{
434436
await requestContext.SendErrorAsync(
435437
$"Attaching to a process with CustomPipeName is only available with PowerShell 6.2 and higher (current session is {runspaceVersion.Version}).");
@@ -461,16 +463,15 @@ await requestContext.SendErrorAsync(
461463
}
462464

463465
// Clear any existing breakpoints before proceeding
464-
await ClearSessionBreakpointsAsync().ConfigureAwait(false);
466+
await ClearSessionBreakpointsAsync().ConfigureAwait(continueOnCapturedContext: false);
465467

466468
// Execute the Debug-Runspace command but don't await it because it
467469
// will block the debug adapter initialization process. The
468470
// InitializedEvent will be sent as soon as the RunspaceChanged
469471
// event gets fired with the attached runspace.
470472
int runspaceId = attachParams.RunspaceId > 0 ? attachParams.RunspaceId : 1;
471473
_waitingForAttach = true;
472-
Task nonAwaitedTask =
473-
_editorSession.PowerShellContext
474+
Task nonAwaitedTask = _editorSession.PowerShellContext
474475
.ExecuteScriptStringAsync($"\nDebug-Runspace -Id {runspaceId}")
475476
.ContinueWith(OnExecutionCompletedAsync);
476477

0 commit comments

Comments
 (0)