Skip to content

'ArgumentOutOfRangeException' issues were fixed in recent versions #1306

Closed

Description

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

Activity

  1. ghost added
    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
    on Jan 21, 2020
  2. ghost removed
    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
    on Jan 21, 2020
  3. changed the title [-]`ArgumentOutOfRangeException` issues have been fixed in recent versions[/-] [+]`ArgumentOutOfRangeException` issues were fixed in recent versions[/+] on Jan 21, 2020
  4. changed the title [-]`ArgumentOutOfRangeException` issues were fixed in recent versions[/-] [+]'ArgumentOutOfRangeException' issues were fixed in recent versions[/+] on Jan 23, 2020
  5. DHowett-MSFT commented on Feb 12, 2020

    @DHowett-MSFT

    Would it be possible to link some of that work? As an API provider (on the console side) I'd like to understand if there's some learnings I can take back to my team. 😄

  6. daxian-dbw commented on Feb 12, 2020

    @daxian-dbw
    MemberAuthor

    Dustin L. Howett (MSFT) (@DHowett-MSFT) Sure, I just added links to those related PRs in the issue description. Hope that helps!

  7. DHowett-MSFT commented on Feb 12, 2020

    @DHowett-MSFT

    Thanks!

  8. bstrobel commented on Sep 22, 2020

    @bstrobel

    Just to let you know, the issue is fixed for me. I use the default PS version on Win10 Professional and executed the following command (in cmd) to upgrade PSReadLine:
    powershell -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -AllowPrerelease"

    Thanks for fixing it!

  9. Backist commented on May 27, 2022

    @Backist
  10. publicmessages commented on Aug 11, 2022

    @publicmessages
  11. daxian-dbw commented on Aug 11, 2022

    @daxian-dbw
    MemberAuthor

    Backest (@Backist) and publicmessages The URL "https://github.com/lzybkr/PSReadLine/issues/new" shown in the exception you saw indicates that you are using a very old version of PSReadLine (prior to 2.0.0-beta2). Please upgrade to the latest version https://www.powershellgallery.com/packages/PSReadLine/2.2.6.

  12. dbrgn commented on Oct 18, 2022

    @dbrgn

    Just wondering, almost 3 years later: I installed a new Windows 10 machine, which has PowerShell preinstalled, but that ships with this outdated version of PSReadLine. Wouldn't it be possible to somehow ship an updated version of PSReadLine with Windows Update, to ensure that a freshly installed and fully updated system doesn't have a 3 years old buggy version of a PowerShell module which explicitly asks the users to open an issue for a long-fixed bug? (From looking through the issue tracker, it seems that it would be a good thing for the project maintainer as well 🙃)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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