-
Notifications
You must be signed in to change notification settings - Fork 512
Error with Function Breakpoints: Debug adapter process has terminated unexpectedly #1159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you save the file to disk and try again. Right now, setting breakpoints won't work for "in-memory" files. That said, we should fix the PSES crash. |
Same problem after saving to disk. I should have mentioned that in the original description, although I think the logs were from a non-saved. |
Doh! :-) |
I can reproduce the error with any saved file. For example opening DebugTest.ps1 which ships as an example as part of the VS Code PowerShell extension. Create a function breakpoint for Write-Host and it will blow up with the same error: Here are the logs for this one: |
Thanks for this report, @jonathanmedd! @rkeithhill: I didn't see too much in the logs but that exception he supplied seems like a good start, would you agree? |
@tylerl0706 looks like this line needs to be updated to check for |
I've been having the exact same issue (on windows and mac), posted previously with no resolution, has this been root caused or a fix made available yet ? |
I've got a fix in the works for this. In the process I found another issue - I think with VSCode's debug protocol. There is a BreakpointEvent that allows the debug adapter to notify VSCode about I could be missing something in the debug protocol spec but just in case, I've raised an issue with the VSCode folks. At the very least, this will eliminate the crash when using a function breakpoint. |
And it turns out the debug protocol is missing this capability - https://github.com/Microsoft/vscode-debugadapter-node/issues/157 So, in the case of the user creating a command breakpoint in PSIC, I'll not have that send a BreakpointEvent to VSCode. |
Fixex PowerShell/vscode-powershell#1159 When VSCode passes us a breakpoint to set, we normally set a flag to indicate "setBreakpointInProgress" so that when the DebugService_BreakpointUpdated event is fired, we can tell that we initiated it instead of the user using Set-PSBreakpoint to set a breakpoint. Well, the code that handled function breakpoints msgs sent by VSCode was not setting that flag. Also, when the user does use Set-PSBreakpoint -Command there is no debug protocol event for function breakpoints so we need to ignore this type of breakpoint set by the user until the debug protocol support it. See https://github.com/Microsoft/vscode-debugadapter-node/issues/157
The fix for this should be in the upcoming 1.6.0 release. |
* Fix PSES crash on debug start when function breakpoint defined Fixex PowerShell/vscode-powershell#1159 When VSCode passes us a breakpoint to set, we normally set a flag to indicate "setBreakpointInProgress" so that when the DebugService_BreakpointUpdated event is fired, we can tell that we initiated it instead of the user using Set-PSBreakpoint to set a breakpoint. Well, the code that handled function breakpoints msgs sent by VSCode was not setting that flag. Also, when the user does use Set-PSBreakpoint -Command there is no debug protocol event for function breakpoints so we need to ignore this type of breakpoint set by the user until the debug protocol support it. See https://github.com/Microsoft/vscode-debugadapter-node/issues/157 * Add comment on why code is commented out
System Details
$PSVersionTable
:Issue Description
I am experiencing a problem with setting a function breakpoint and using the VS Code debugger. The issue occurs in both PS Core 6 RC2 and PS 5.1.
Example code:
Create a function breakpoint for Write-Host:
will produce the following error on PS Core 6 when starting the debugger. (PS 5.1 does not produce error text)
An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit.
Unhandled Exception: 1..10 | ForEach-Object {Write-Host "Hello World"}
System.ArgumentException: Unexpected breakpoint type: CommandBreakpoint
at Microsoft.PowerShell.EditorServices.BreakpointDetails.Create(Breakpoint breakpoint)
at Microsoft.PowerShell.EditorServices.Protocol.Server.DebugAdapter.<DebugService_BreakpointUpdated>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Hit Command breakpoint on 'Write-Host'
PowerShell Core 6 RC2
PowerShell 5.1
Attached Logs
DebugLogs.zip
The text was updated successfully, but these errors were encountered: