Repository navigation
Resizing windows before Escape results in ArgumentOutOfRangeException #1884
Copy link
Copy link
Closed
Labels
Issue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Resolution-Fixed
Milestone
Description
Environment
PSReadLine: 2.0.2
PowerShell: 7.0.3
OS: Microsoft Windows 10.0.19041
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 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 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 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 Backspace Backspace Backspace Backspace Backspace Backspace Backspace g e t Enter
UpArrow Escape
Exception
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')
Actual value was 29.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.RevertLine(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)
PS version: 7.0.3
PSReadline version: 2.0.2
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 7.0.3.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 131
BufferHeight: 29
Exception report
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')
Actual value was 29.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.RevertLine(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)
Steps to reproduce
I was using Powershell to issue a few HTTPie commands, which involved recalling the last command and using left and/or ctrl+left to go back over the last command to slightly edit it. I resized the window (for the purposes of a screen shot) and this issue occured.
[Edited] This issue happens only when you resize the window after UpArrow and before Escape.
Expected behavior
No error message
Actual behavior
The error
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.md
Along with the details above
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Resolution-Fixed
Activity
daxian-dbw commentedon Oct 16, 2020
Mark Murphy (@markSmurphy) Thanks for reporting this issue. We have been receiving some reports about this exception stack on PSReadLine 2.0.x versions but couldn't get a repro to investigate the problem.
Looking at the the
Last 200 Keys, when did you resize the window? For example, did you resize the window after theUpArrowand beforeEscape?How did you resize the window? Shrink/increase both the width and height? Shrink/increase only the width or height?
Information about those questions would be very helpful to our investigation. Thank you in advance!
daxian-dbw commentedon Oct 16, 2020
Also, if possible, can you please share a screenshot of the terminal content that is shown right above the exception message?
markSmurphy commentedon Oct 16, 2020
Here's the screen shot you asked for.
In case it's relevant, the pwsh.exe process has been active for 17 days, so there's quite a build up of command history.
I can't reproduce this at will.
You can make out (in the screen shot below) the HTTPie command at the top of the screen "http get https://...." - the previous command was "http options https://..." and you can see in the "Last 200 keys" me navigating back over the line, deleting the seven characters in " O P T I O N S" and replacing it with "get" before executing it.

daxian-dbw commentedon Oct 16, 2020
Mark Murphy (@markSmurphy) Appreciate your reply and the screenshot. I think I can reproduce the exception now. Will investigate further. Thanks.
ckrueger1979 commentedon Oct 28, 2020
Haveing the same problem. For me it happens frequently after pasting text from Outlookt to Powershell
daxian-dbw commentedon Oct 30, 2020
@ckruegerkpmg I doubt you are facing the same issue. This issue happens only when you resize the window after
UpArrowand beforeEscape.If you see the same exception stack, it's likely already fixed (see #1306). Please upgrade to the 2.1.0-rc1 version of PSReadLine from PowerShellGallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.
taketakeyyy commentedon Nov 8, 2020
daxian-dbw commentedon Nov 9, 2020
takey (@taketakeyyy) You are using a very old version of PSReadLine, maybe 2.0.0-beta1 or prior. Please upgrade to the 2.1.0 version of PSReadLine from PowerShellGallery. See the upgrading section for instructions. Please file a new issue if you run into the same issue with the latest version.
maettu-this commentedon Feb 4, 2021
maettu-this commentedon Feb 4, 2021
[-]System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')[/-][+]Resizing windows before `Escape` results in ArgumentOutOfRangeException[/+]