Skip to content

'ArgumentOutOfRangeException' issues were fixed in recent versions #1306

Closed
@daxian-dbw

Description

@daxian-dbw

Quite a few fixes were made to address the various issues related to the ArgumentOutOfRangeException thrown from PSReadLine.
The exception usually has a stack trace that looks like one of the followings.

If you run into a similar issue, please try out the latest version of PSReadLine from PowerShell Gallery.
You may find the Installation and Upgrading instructions helpful.

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -7.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   ...
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was 9001.
   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.Menu.DrawMenu(Menu previousMenu, Boolean menuSelect)
   ...
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 9001.
   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLine(Nullable`1 key, Object arg)
   ...

The PRs that fixed those issues are:
#979, #967 -- these 2 PRs fixed most of the ArgumentOutOfRangeException thrown from ReallyRender.
#984, #1182, #1206 -- they fixed the exception thrown in other scenarios.

Here is an in-complete list of the closed duplicate issues related to the ArgumentOutOfRangeException:
https://github.com/powershell/psreadline/issues?q=is%3Aissue+label%3AOutOfRange+is%3Aclosed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions