Skip to content

PSReadLine Cursor Position Out-of-Range Exception Analysis #5027

@RAM830-TECH

Description

@RAM830-TECH

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

Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

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 name: left
Actual value was -2.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(...)

Screenshot

This report explains the cause, behavior, and possible solutions for the error encountered in PowerShell involving the PSReadLine module. The error message indicates a failure related to cursor positioning within the console buffer. This is a common issue when the console attempts to render user input but receives invalid cursor coordinates.

Environment data

PS Version: 5.1.19041.6456
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 3000

Steps to reproduce

ACTUALLY, I trying to write a program in vs code like based on how if else work when I run the code it shows this error show I COME HERE and report these issue . thanks

Expected behavior

N/A

Actual behavior

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions