Skip to content
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

Exception thrown when stopping a stuck git log session with Alt+Pause #3260

Closed
3 tasks done
scaramushe opened this issue Apr 5, 2022 · 8 comments · Fixed by #3629
Closed
3 tasks done

Exception thrown when stopping a stuck git log session with Alt+Pause #3260

scaramushe opened this issue Apr 5, 2022 · 8 comments · Fixed by #3629
Labels
Area-Stability Label for tracking stability Issues Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Repro There is no sufficient information on repro steps. Resolution-Fixed

Comments

@scaramushe
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

### Environment
PSReadLine: 2.1.0
PowerShell: 5.1.22000.282
OS: Microsoft Windows 10.0.22000
BufferWidth: 138
BufferHeight: 70

Last 200 Keys

 2 e 1 Enter
 g i t Spacebar l o g Spacebar 3 3 9 8 2 e 1 Enter
 UpArrow UpArrow UpArrow DownArrow Ctrl+Backspace - - a b o Tab Enter
 UpArrow UpArrow DownArrow Ctrl+Backspace Backspace Backspace c 5 9 5 5 f 7 0 7 6 8 c 2 2 3 9 1 7 9 b 3 5 5 b 7 b 5 4 6 3 9 1 a 4 a d 6 4 7 7 Enter
 UpArrow UpArrow UpArrow UpArrow Enter
 UpArrow Ctrl+Backspace 6 5 b 9 b 8 2 Enter
 UpArrow Ctrl+Backspace 6 d 7 3 8 e c Enter
 UpArrow Ctrl+LeftArrow Ctrl+Backspace Ctrl+Backspace l o g Spacebar Enter
 q Backspace g i t Spacebar m e r g e t Tab Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow Enter
 UpArrow UpArrow DownArrow Ctrl+Backspace Backspace Backspace 5 1 f e 6 8 0 6 a b e 7 2 d d 8 9 6 c c 3 d a d 8 3 e c e 3 2 1 7 2 7 3 d b 5 b Enter
 UpArrow UpArrow Enter
 g i t Spacebar l o g Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow Enter
 Alt+Pause

Exception

System.InvalidOperationException: Queue empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Queue`1.Dequeue()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

Screenshot

image

Environment data

PS Version: 5.1.22000.282
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.1.0
PSReadLine EditMode: Windows
OS: 10.0.22000.1 (WinBuild.160101.0800)
BufferWidth: 138
BufferHeight: 70

Steps to reproduce

When recovering from issue reproted in microsoft/terminal#12828, pressed Alt+Pause to break out of stuck state.
Then pressed it again and got this error

Expected behavior

No exception

Actual behavior

Exception

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Apr 5, 2022
@scaramushe
Copy link
Author

Another comment - the git autocomplete is posh-git

@daxian-dbw
Copy link
Member

This is a very strange issue. I cannot reason from the ReadOneOrMoreKeys method about when it would return with an empty _queuedKeys. Seems impossible to me ...

You mentioned in the windows terminal issue that you pressed Alt+Pause to break out of the unresponsive git log. Did you then, as indicated by your screenshot, start to debug a PowerShell script and press Alt+Pause again which led to the exception? I ask this because your last 200 keys shows Alt+Pause as the last input.

@scaramushe
Copy link
Author

Yes, this is the sequence - pressing Alt-Pause to break out and again (for no reason :) ) and getting the error

@PrzemyslawKlys

This comment was marked as off-topic.

@daxian-dbw

This comment was marked as outdated.

@StevenBucher98 StevenBucher98 added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Stability Label for tracking stability Issues labels Jan 6, 2023
@StevenBucher98
Copy link
Collaborator

Related PowerShell/vscode-powershell#4470

@andyleejordan
Copy link
Member

This is a very strange issue. I cannot reason from the ReadOneOrMoreKeys method about when it would return with an empty _queuedKeys. Seems impossible to me ...

You mentioned in the windows terminal issue that you pressed Alt+Pause to break out of the unresponsive git log. Did you then, as indicated by your screenshot, start to debug a PowerShell script and press Alt+Pause again which led to the exception? I ask this because your last 200 keys shows Alt+Pause as the last input.

We were looking at this issue again and the hunch we've got is that the Break key (aka Alt+Pause) is "often translated instantly" in contrast to a key like Ctrl+C where the keyboard buffer still receives input. This would explain why we have nothing to dequeue, because while we expected an input to be queued, nothing was. We'll need to look at what .NET is doing for the Break key.

@daxian-dbw daxian-dbw added the Needs-Repro There is no sufficient information on repro steps. label Mar 21, 2023
@ghost ghost added the In-PR A PR is opened targeting the issue label Mar 21, 2023
@ghost ghost added Resolution-Fixed and removed In-PR A PR is opened targeting the issue Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Mar 21, 2023
@ghost
Copy link

ghost commented May 3, 2023

🎉 This issue was addressed in 3629, which has now been successfully released in v2.3.1-beta1. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Stability Label for tracking stability Issues Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Repro There is no sufficient information on repro steps. Resolution-Fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants