@@ -23,6 +23,8 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.Server
23
23
{
24
24
public class DebugAdapter
25
25
{
26
+ private static Version _minVersionForCustomPipeName = new Version ( 6 , 2 ) ;
27
+
26
28
private EditorSession _editorSession ;
27
29
28
30
private bool _noDebug ;
@@ -429,7 +431,7 @@ await requestContext.SendErrorAsync(
429
431
}
430
432
else if ( customPipeNameIsSet )
431
433
{
432
- if ( runspaceVersion . Version . Major < 6 && runspaceVersion . Version . Minor < 2 )
434
+ if ( runspaceVersion . Version < _minVersionForCustomPipeName )
433
435
{
434
436
await requestContext . SendErrorAsync (
435
437
$ "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(
461
463
}
462
464
463
465
// Clear any existing breakpoints before proceeding
464
- await ClearSessionBreakpointsAsync ( ) . ConfigureAwait ( false ) ;
466
+ await ClearSessionBreakpointsAsync ( ) . ConfigureAwait ( continueOnCapturedContext : false ) ;
465
467
466
468
// Execute the Debug-Runspace command but don't await it because it
467
469
// will block the debug adapter initialization process. The
468
470
// InitializedEvent will be sent as soon as the RunspaceChanged
469
471
// event gets fired with the attached runspace.
470
472
int runspaceId = attachParams . RunspaceId > 0 ? attachParams . RunspaceId : 1 ;
471
473
_waitingForAttach = true ;
472
- Task nonAwaitedTask =
473
- _editorSession . PowerShellContext
474
+ Task nonAwaitedTask = _editorSession . PowerShellContext
474
475
. ExecuteScriptStringAsync ( $ "\n Debug-Runspace -Id { runspaceId } ")
475
476
. ContinueWith ( OnExecutionCompletedAsync ) ;
476
477
0 commit comments