Psreadline: System.ArgumentOutOfRangeException

Created on 16 Nov 2019  路  7Comments  路  Source: PowerShell/PSReadLine

Last 106 Keys:
c Space d Tab Backspace Backspace d Space Tab Tab Tab Tab Tab s r c \ Tab Enter
d o t n e t Space r u n Enter
UpArrow UpArrow Enter
c l s Enter
UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace d o Tab Tab c l s Enter
Tab Tab Tab Tab Tab Tab Enter
Enter
Enter
UpArrow UpArrow UpArrow DownArrow DownArrow DownArrow DownArrow DownArrow d o d o

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

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: 94
BufferHeight: 42

All 7 comments

@Serfin, can you give PSReadLine 2.0.0-beta6 a try, from PowerShellGallery, and see if the issue goes away?

Here's a much more reduced version of the same error, if that helps anyone:

Last 2 Keys:
 UpArrow DownArrow

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 -7.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.HistoryRecall(Int32 direction)
   at Microsoft.PowerShell.PSConsoleReadLine.NextHistory(Nullable`1 key, Object arg)
   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)
-----------------------------------------------------------------------

Very similar bug, probably the same:
Powershell 5.1.18362.145
Windows 10 version 1903 build 18362.476
Two monitors, both 1920x1080, primary is to the right

  1. Copy the following text into the clipboard
Write-Output `
"A", `
"A", `
"A", `
"A" |
Write-Output |
Write-Output |
Write-Output |
Write-Output
  1. Start Powershell by doing start --> run --> powershell
  2. Maximize the window by pressing Win-Up
  3. Paste the text by pressing Shift-Insert
PS C:\Users\durettke>
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 2 Keys:
 ` Shift+Insert

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 -3.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Paste(Nullable`1 key, Object arg)
   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)
-----------------------------------------------------------------------
PS C:\Users\durettke> Write-Output `
>> "A", `
>> "A", `
>> "A", `
>> "A" |
>> Write-Output |
>> Write-Output |
>> Write-Output |
>> Write-Output
A
A
A
A
PS C:\Users\durettke> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Users\durettke>

This happens to me only when using the new Microsoft Terminal and being on the last line of said terminal.

I installed the latest pre-release version and this error goes away! 馃槉

Please give PSReadLine 2.0.0-beta6 a try, from PowerShellGallery. The reported issue was fixed.

Looks like the error is gone :)

Was this page helpful?
0 / 5 - 0 ratings