When pasting a string longer than 5645 characters in a Visual Studio 2019 Developer PowerShell Console, an ArgumentOutOfRangeException is raised. #6231

Open
opened 2026-01-31 00:32:58 +00:00 by claunia · 0 comments
Owner

Originally created by @harlam357 on GitHub (Jan 31, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.592]
Windows Terminal version (if applicable): 0.8.10261.0

Any other software? Microsoft Visual Studio Enterprise 2019 Version 16.4.2

Steps to reproduce

When right-click pasting a string longer than 5645 characters in a Visual Studio 2019 Developer PowerShell Console, an ArgumentOutOfRangeException is raised.

Expected behavior

Terminal accepts the pasted string. I could not reproduce the behavior in a standard PowerShell host or the 2019 Developer PowerShell host. The exception is being raised from what looks like a PowerShell specific path, but since I can only reproduce in Terminal I'm reporting the bug here.

Actual behavior

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

-----------------------------------------------------------------------
Last 200 Keys:
 6 , 1 9 4 7 7 , 1 9 4 7 8 , 1 9 5 3 2 , 1 9 5 3 3 , 1 9 5 3 4 , 1 9 5 3 5 , 1 9 5 3 6 , 1 9 5 3 7 , 1 9 5 3 8 , 1 9 5 3 9 , 1 9 5 4 7 , 1 9 5 4 8 , 1 9 5 4 9 , 1 9 5 5 0 , 1 9 5 5 1 , 1 9 5 5 2 , 1 9 5 5 3 , 1 9 5 5 4 , 1 9 7 6 3 , 1 9 7 6 4 , 1 9 7 6 5 , 1 9 7 6 6 , 1 9 7 6 7 , 1 9 7 6 8 , 1 9 7 6 9 , 1 9 7 7 0 , 1 9 7 7 2 , 1 9 7 7 3 , 1 9 7 7 4 , 1 9 7 7 5 , 1 9 7 7 6 , 1 9 7 7 7 , 1 9 7 7 8 ,

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 -8.
   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.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(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)
-----------------------------------------------------------------------
Originally created by @harlam357 on GitHub (Jan 31, 2020). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.592] Windows Terminal version (if applicable): 0.8.10261.0 Any other software? Microsoft Visual Studio Enterprise 2019 Version 16.4.2 ``` # Steps to reproduce When **right-click** pasting a string longer than 5645 characters in a Visual Studio 2019 Developer PowerShell Console, an ArgumentOutOfRangeException is raised. # Expected behavior Terminal accepts the pasted string. I could not reproduce the behavior in a standard PowerShell host or the 2019 Developer PowerShell host. The exception is being raised from what looks like a PowerShell specific path, but since I can only reproduce in Terminal I'm reporting the bug here. # Actual behavior Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new ``` ----------------------------------------------------------------------- Last 200 Keys: 6 , 1 9 4 7 7 , 1 9 4 7 8 , 1 9 5 3 2 , 1 9 5 3 3 , 1 9 5 3 4 , 1 9 5 3 5 , 1 9 5 3 6 , 1 9 5 3 7 , 1 9 5 3 8 , 1 9 5 3 9 , 1 9 5 4 7 , 1 9 5 4 8 , 1 9 5 4 9 , 1 9 5 5 0 , 1 9 5 5 1 , 1 9 5 5 2 , 1 9 5 5 3 , 1 9 5 5 4 , 1 9 7 6 3 , 1 9 7 6 4 , 1 9 7 6 5 , 1 9 7 6 6 , 1 9 7 6 7 , 1 9 7 6 8 , 1 9 7 6 9 , 1 9 7 7 0 , 1 9 7 7 2 , 1 9 7 7 3 , 1 9 7 7 4 , 1 9 7 7 5 , 1 9 7 7 6 , 1 9 7 7 7 , 1 9 7 7 8 , 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 -8. 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.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(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) ----------------------------------------------------------------------- ```
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 00:32:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6231