System.ArgumentOutOfRangeException: 该值必须大于或等于零,且必须小于控制台缓冲区在该维度的大小。
参数名: top
实际值是 -1。
在 System.Console.SetCursorPosition(Int32 left, Int32 top)
在 Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
在 Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
在 Microsoft.PowerShell.PSConsoleReadLine.HistoryRecall(Int32 direction)
在 Microsoft.PowerShell.PSConsoleReadLine.PreviousHistory(Nullable`1 key, Object arg)
在 Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
在 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
在 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
PS Version: 5.1.19041.1645
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 3000
按 UpArrow 触发 HistoryRecall → ReallyRender 里 SetCursorPosition(top=-1) 抛 ArgumentOutOfRangeException,PSReadLine 崩溃。
Prerequisites
Exception report
Screenshot
no
Environment data
Steps to reproduce
Get-ChildItem C:\Windows -Recurse | Select-Object -First 5000),让缓冲区滚动。cls或调整终端窗口大小。Expected behavior
翻历史时正常渲染,不抛异常。
Actual behavior
按 UpArrow 触发 HistoryRecall → ReallyRender 里 SetCursorPosition(top=-1) 抛 ArgumentOutOfRangeException,PSReadLine 崩溃。