Skip to content

Fix bad context state after debugging - #1210

Merged
Rob Holt (rjmholt) merged 6 commits into
PowerShell:masterfrom
rjmholt:abort-ready-fix
Feb 28, 2020
Merged

Rob Holt (rjmholt) merged 6 commits into
PowerShell:masterfrom
rjmholt:abort-ready-fix

Conversation

@rjmholt

Copy link
Copy Markdown
Contributor

Fixes PowerShell/vscode-powershell#2364.
Fixes PowerShell/vscode-powershell#2488.
May fix PowerShell/vscode-powershell#2396.

After debugging is stopped, the PowerShellContextService was being marked as being in session state aborted. Now we set the state to ready.

This fix isn't ideal, since it's made without a full understanding of the conceptual state machine of the PowerShellContextService, but it does fix the issues for the coming release while we sift through the actual architectural cause of the problem (and ideally fix it down the line)

@SeeminglyScience

Copy link
Copy Markdown
Collaborator

Can you test CTRL + C in various situations? Like hit a debugger stop, manually run Start-Sleep 10, try to CTRL + C?

I feel like I did something like this early on and it broke something but I can't remember what or why...

@rjmholt

Copy link
Copy Markdown
Contributor Author

Like hit a debugger stop, manually run Start-Sleep 10, try to CTRL + C?

This one seems to work nicely.

I imagine there is an issue somewhere here. But if we don't find it, I think this change should go in, since the devil we know is quite bad

@rjmholt

Copy link
Copy Markdown
Contributor Author

Ah, it's the second Ctrl-C that gets ignored. I'm ok with that one for now. If we can find a better implementation before Tuesday, we can put it in this PR. Otherwise will bugfix it later

@rjmholt

Copy link
Copy Markdown
Contributor Author

Patrick Meinecke (@SeeminglyScience) do you know where we process ctrl C? I'd like to get a better picture of what's going on so I can think about what a fix might look like

@rjmholt

Rob Holt (rjmholt) commented Feb 28, 2020 •

Copy link
Copy Markdown
Contributor Author

Ok, I've now made it so that sleep 10 works. I'm not sure if this could corrupt some state, but it seems not to have in my limited uses.

Basically abort opportunistically tries to acquire the lock to fire the execution status changed event. If there's a command running, it won't get the lock and no event is fired.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as ctrl c isn't broken I'm cool with this as a temp fix. Maybe we should get an issue opened to take a pass at this for vnextnext.

@rjmholt
Rob Holt (rjmholt) merged commit 35fd46d into PowerShell:master Feb 28, 2020
@rjmholt
Rob Holt (rjmholt) deleted the abort-ready-fix branch February 28, 2020 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Preview-2020.2.0] F5 works only once Can't edit watch variables when paused in debugging Intellisense loss after debugging

3 participants