-
Notifications
You must be signed in to change notification settings - Fork 511
Debugger frozen after first breakpoint #987
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
Debugger frozen after first breakpoint #987
Comments
Thanks Jack, I'll take a look. |
I try and troubleshoot this at least once a week. Something I discovered today is that if I hit enter in the integrated console window, the debugger will move to the next line of code. Here are my steps:
It seems like it's working every other time for whatever reason, without hitting enter at least. |
Version 1.16.1 suddenly stopped working. Have noticed that sometimes it will eventually (like up to 30 seconds) step to next line, but even as poor a coder as i am i dont need that long to read a line of code! Reinstall worked on my work desktop which isnt Anniversay edition so im thinking it might be related to PS5.1? |
My issue is strictly with macOS and PowerShell 6, unfortunately. |
I've just tested this with a fresh install of macOS and can confirm it's still a problem. |
Can you attach a zip of the EditorServices log file? If the debug adapter log file indicates a connection was made then we need to see the EditorServices log file. BTW sorry for the delay on this. There's been a change in personnel working on this extension and the new folk(s) need to come up to speed - after they free up from the push to release PS Core 6. |
I've attached the log. This was a fresh log after running the debugger and watching my breakpoints freeze. I can get them to continue if I hit the enter key in the terminal, but I have to do that every other thing. |
I think what you are seeing is a bug that exists on Linux and macOS where once a breakpoint has been hit, you have to press a key in the integrated console before you can resume debugging. Can you try this to see if that is indeed the case. It's not really a workaround as it's a major PITA to have to do this whenever a breakpoint has been hit. |
Yes, that's the one. Any ETA on a fix? It's been like this for a few months, now. It makes PowerShell almost impossible to use in VS Code. |
@SeeminglyScience Are you working on a fix for the console ReadKey() bug on Linux/macOS? |
@rkeithhill Not currently, I'm working on getting PSReadLine working but that has the same issue unfortunately. I'll see if I can come up with something this weekend. |
I got a Linux environment set up to dig into this issue, and I think I found the cause.
Add all that together and it looks like ReadKey is blocking the pipeline thread, but it's really the Here's some easier repo steps that work in pwsh without PSES $rs = [runspacefactory]::CreateRunspace($Host)
$rs.Open()
$ps = [powershell]::Create()
$ps.Runspace = $rs
$handle = $ps.AddScript('[Console]::ReadKey($true)').BeginInvoke()
Start-Sleep 1 If you debug pwsh on Linux, run the above, and pause the debugger it'll be stopped here waiting for cursor position. A possible (but sort of dirty) solution is to write a query escape sequence like Device Attributes to Here's an example of what I mean using the repo steps above $rs = [runspacefactory]::CreateRunspace($Host)
$rs.Open()
$ps = [powershell]::Create()
$ps.Runspace = $rs
$handle = $ps.AddScript('[Console]::ReadKey($true)').BeginInvoke()
Start-Sleep 1
[Console]::Write("`u{1b}[0c")
while ([Console]::KeyAvailable) {
$null = [Console]::ReadKey($true)
} @tylerl0706 @daviwil @rkeithhill Any concerns with this approach? |
One concern is the use of My original attempt at fixing this was to use Since you are using pwsh there is a direct escape code for esc which is |
@rkeithhill Hmm, it didn't echo when I was testing it, and I can't get it to echo with the example. But it does echo if I take away the initial call to I should clarify though, For example, in my Ubuntu vm the escape sequence emits this: KeyChar Key Modifiers
------- --- ---------
� Escape 0
? 0 0
6 D6 0
2 D2 0
; 0 0
c C 0 The escape releases the first It would be ideal if there was an escape sequence that emits a single character, but I don't know of one :\
Awesome! I didn't know about that one, that's really cool :) |
Tried that out, didn't work great unsurprisingly. The only way I was able to fix this was by pulling out the little bit of native code corefx uses and working that into a implementation similar to yours @rkeithhill. It appears to work great, but a discussion needs to be had about how it should be integrated. I can think of three options.
|
@SeeminglyScience Looks like @rkeithhill opened an issue about your 3rd choice a little over a month ago https://github.com/dotnet/corefx/issues/25036 - maybe it's worth pinging on that issue to see what they say? |
The last time I asked them for this they didn't seem very interested, hopefully it's different this time. I agree with Patricks approach #2, creating a small helper library that doesn't need to get recompiled with PSES. If we could make it work then we only need to compile/sign/ship it once and then use it in future PSES releases until corefx gains a ReadKeyAsync API. Very nice work, @SeeminglyScience, you rock! |
@SeeminglyScience I like option 2 as well. Hopefully option 3 comes to pass but who knows how long that will take. We can't afford to wait - folks are getting pretty upset about this. And if option 3 does happen, then the changes to PSES would be minimized vs option 1. |
+1 for option 2! |
System Details
$PSVersionTable
:Reproduce
Issue Description
I cannot use the debugger in VS Code as expected. Once I try to step into a breakpoint or continue running a script, the debugging process appears to freeze. There are no visible errors and I can continue navigating and using VS Code. To continue and reproduce the issue, again, I have to stop the debugging process and restart the console.
Additionally, I've gone through and removed the extension, tried the latest insider build of VS Code and rolled back to PowerShell 6 Beta 3 and 4.
Attached Logs
logs.zip
The text was updated successfully, but these errors were encountered: