Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentOutOfRangeException: Console Buffer Size Issue in PowerShell PSReadLine #4227

Closed
3 tasks done
Umesh-008 opened this issue Oct 16, 2024 · 2 comments
Closed
3 tasks done

Comments

@Umesh-008
Copy link

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

I encountered a `System.ArgumentOutOfRangeException` while using VS code and want to print("hellow world", "\n", "your computer is hacked" ), which occurred when setting the console's cursor position. Below is the error message I received:
Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
Last 7 Keys: & Space C : / U s

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 at System.Console.SetCursorPosition(Int32 left, Int32 top) at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value) at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor) at Microsoft.PowerShell.PSConsoleReadLine.ForceRender() at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Screenshot

WhatsApp Image 2024-10-16 at 10 18 38 PM

Environment data

PS Version: Major- 5, Minor- 1,Build- 19041, Revision- 5007
PS HostName: ConsoleHost
PSReadLine Version: Module Type- Script, Version- 2.0.0, Name- PSReadline 
PSReadLine EditMode: Windows
Os: Microsoft Windows [Version 10.0.19045.5011]
BufferWidth: 120
bufferheight: 3000

Steps to reproduce

WhatsApp Image 2024-10-16 at 10 18 38 PM
I just used the Fn in VS code in Pyhton language that print("hellow world", "\n" "your computer is hacked").
Please find the attached image for your better understanding

Expected behavior

hellow world
your computer is hacked

Actual behavior

WhatsApp Image 2024-10-16 at 10 18 38 PM

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 16, 2024
@Umesh-008
Copy link
Author

Hi, I’m a beginner at coding, and I encountered this error while coding in inside Visual Studio Code for Python Language. I'm not very familiar with concepts like PowerShell version, buffer height/width, and PSReadLine. Could you guide me on how to find the details you need or if there's something specific I should do to resolve this issue?

Thanks for your help!

@daxian-dbw
Copy link
Member

daxian-dbw commented Oct 16, 2024

You are using a very old version of the PSReadLine module (2.0.0-beta2 or prior). The issue can be resolved by upgrading to the latest 2.3.6 version of PSReadLine, simply by running Install-Module PSReadLine -RequiredVersion 2.3.6 -Repository PSGallery -Scope CurrentUser from within your PowerShell. Afterwards, start a new PowerShell session and you should be good to go.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants