Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
The stop
button in the UI causes the PSIC>
error, 100% of the time.
When paused in a break point:
- click continue, and everything works
- click stop, it breaks
The callstack is always the same
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Maybe Related or Not?
This is complicated. The reason it started happening is that we synced the state of the PowerShell debugger and the VS Code debugger. We did this by essentially checking on each REPL if the PowerShell debugger was still running; if not, we stop the VS Code debugger. This seems to be the edge case where that behavior is not wanted, so we need another condition, but it's a whole lot of complex state tracking.
Originally posted by @andschwa in #3998 (comment)
or fix it so that issuing a command doesn't stop the debugger @JustinGrote
Does command "issue a command" mean running commands in the REPL? Or Clicking stop on the UI? For this case, when paused in a breakpoint:
- I can continue to use to use the PSIT REPL, as normal
- hitting
f5
orcontinue
it works as normal - it's only when I click
stop
that it explodes.
PowerShell Version
Name Value
---- -----
PSVersion 7.2.4
PSEdition Core
GitCommitId 7.2.4
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
1.67.2
c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
x64
Extension Version
ms-vscode.powershell@2022.5.1
TylerLeonhardt.vscode-inline-values-powershell@0.0.5
Steps to Reproduce
To Recreate: Stop on -EA 'break' plus nested Scope
This one breaks 100% of the time, even on new windows
function doWork {
if ($true) {
Write-Error 'normally -Continue'
<#
while in the breakpoint:
hit continue -> normal behavior
click stop -> PSIC spam.
#>
}
'other stuff'
}
if ($true) {
& {
$ErrorActionPreference = 'break'
doWork
}
}
Example2 : Sometimes breaks
I ran this 5 times in a row. They were okay until the 5th time it crashed.
if ($true) {
& {
$ErrorActionPreference = 'break'
$x = 0; $x; # breakpoint here
$ErrorActionPreference = 'stop'
}
}
Example that Works: No Nested Scope, No Crash
if ($true) {
$ErrorActionPreference = 'break'
$x = 0 # breakpoint here
$ErrorActionPreference = 'stop'
}
Visuals
No response