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

Exception: System.ArgumentOutOfRangeException - powershell inside code-insiders #1174

Closed
testautomation opened this issue Nov 12, 2019 · 5 comments

Comments

@testautomation
Copy link

This happend in powershell inside code-insiders

Environment data

PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta2
os: 10.0.18362.1 (WinBuild.160101.0800)
PS file version: 10.0.18362.1 (WinBuild.160101.0800)
HostName: ConsoleHost
BufferWidth: 92
BufferHeight: 33

Steps to reproduce or exception report

Last 200 Keys:
... 
Enter
 UpArrow UpArrow UpArrow UpArrow Enter
 Ctrl+l

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: top
Actual value was -69.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 
dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
@daxian-dbw
Copy link
Member

A few variants of the ArgumentOutOfRangeException was fixed in 2.0.0-beta5 version of PSReadLine. Can you try it from PowerShellGallery?

@wqsa
Copy link

wqsa commented Nov 13, 2019

2.0.0-beta5 still have this problem.

Environment

PSReadLine: 2.0.0-beta5
PowerShell: 7.0.0-preview.4
OS: Microsoft Windows 10.0.17763
Last 200 Keys

 DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow p c d n Spacebar s t a r t Spacebar - d a t a d i r Spacebar p e e r 1 Spacebar - c o n f i g Spacebar p c d n . c o n f Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 Ctrl+c UpArrow Enter
 UpArrow Enter
 Ctrl+c UpArrow Enter
 UpArrow DownArrow Ctrl+c UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow UpArrow DownArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow UpArrow DownArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 Ctrl+c UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Home d l v Spacebar e x e Spacebar Spacebar Backspace Backspace c Spacebar RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow - - Spacebar Enter

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 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)
   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)

@msftrncs
Copy link
Collaborator

@wqsa, Theres a good chance this is fixed by #1146, but this is different than @testautomation's exception report. It'd take the command you were editing, and the size of your buffer, to see if it falls under the fix in #1146.

@msftrncs
Copy link
Collaborator

I take that back, @wqsa's exception is occurring in AcceptLineImpl(), which does not use MoveCursor() so I don't think this is covered by #1146, AcceptLineImpl() and any others, should probably be changed to use MoveCursor() for better future handling of multiline editing. I'll look in to this in a bit.

@daxian-dbw
Copy link
Member

Close via #1182. Thanks @msftrncs for the fix. The fix is included in the 2.0.0-beta6 version, which has been published to PowerShellGallery.

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

3 participants