Skip to content

Exception report requested: Running a large block from VSCode editor, containing a debug breakpoint causes Queue Empty Exception #4470

Closed
@jhoneill

Description

@jhoneill

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.2.5
PowerShell: 2022.5.1
OS: Microsoft Windows 10.0.22000
BufferWidth: 281
BufferHeight: 42

Last 200 Keys:

 LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Shift+RightArrow Spacebar Enter
 UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow RightArrow RightArrow RightArrow RightArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Delete Enter
 UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Delete Enter
 UpArrow Shift+Home Ctrl+x n e w - m RightArrow Backspace p Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Shift+Tab Shift+Home Delete p p q Enter
 p Enter
 c d Spacebar - Enter
 c

### Exception

System.InvalidOperationException: Queue empty.
   at System.Collections.Generic.Queue`1.ThrowForEmptyQueue()
   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, Nullable`1 lastRunStatus)

Screenshot

image

In the screen shot command 551 tried to run 18 lines of code from the VSCode editor window with [F8],
This was in the wrong directory so the first command failed.
A later command dropped into the debugger and at the same time a series of "PSIC>" appeared. When this happens normally the only way to regain control of VSCode is to terminate the PowerShell console but this time the sequence stopped.
edit This has happened again and the PSIC doesn't appear.
One cd command took me to the previous directory and starting to enter the next caused the exception.

PS Readline threw the same exception for subsequent commands.

Environment data

PS Version: 7.2.3
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.2.5
PSReadLine EditMode: Windows
OS: 10.0.22000.1 (WinBuild.160101.0800)
BufferWidth: 263
BufferHeight: 39

Steps to reproduce

edit I filed this more in the hope it might help with other reports. On restarting the error occurred again. There does appear to be something related to "[f8]ing" sufficient text - this is 18 lines and 2120 bytes 0 when the code concerned triggers the debugger. Once the System.InvalidOperationException: Queue empty. message has appeared some but not all [F10] / [F11] actions in debugger cause additional exceptions. I can't see a pattern to those which do and those which don't

Expected behavior

No Exception

Actual behavior

Exception as above

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions