System.ArgumentOutOfRangeException PSReadLine: 2.1.0-beta1 PowerShell: 7.1.0-preview.2
See original GitHub issueEnvironment
Name | Value |
---|---|
PS version | 7.1.0-preview.2 |
PSReadline version | 2.1.0-beta1 |
os | 10.0.19613.1000 (WinBuild.160101.0800) |
PS file version | 7.1.0.0 |
HostName | ConsoleHost |
BufferWidth | 127 |
BufferHeight | 1000 |
Last 200 Keys
I n A r c h i v e F o r m a t ] : : X Z ) Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow LeftArrow LeftArrow Shift+Ctrl+LeftArrow $ r . C o n t e n t Ctrl+z Escape # Backspace $ s RightArrow Spacebar RightArrow LeftArrow RightArrow Shift+Ctrl+LeftArrow Shift+Ctrl+LeftArrow Ctrl+RightArrow Ctrl+RightArrow RightArrow Spacebar LeftArrow LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Shift+LeftArrow Delete Delete Enter
$ s e v Tab Enter
UpArrow UpArrow Ctrl+a Ctrl+x N e w - O b j e c t Spacebar - T y p e N a m e Spacebar S e v e n Z i p E x t r a c t o r Spacebar - A r g u m e n t L i s t Spacebar @ ( $ s e v e n Z i p S t r e a m , [ S e v e n Z i p . I n A r c h i v e F o r m a t ] : : X Z ) Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+RightArrow LeftArrow LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+RightArrow [ ] Backspace Backspace Escape
Exception
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'length')
at System.Text.StringBuilder.Remove(Int32 startIndex, Int32 length)
at Microsoft.PowerShell.PSConsoleReadLine.EditItemInsertChar.Undo()
at Microsoft.PowerShell.PSConsoleReadLine.RevertLine(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)
Steps to reproduce
Investigating…
Expected behavior
Actual behavior
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Announcing PSReadLine 2.1+ with Predictive IntelliSense
PSReadLine 2.1.0 will ship with PowerShell 7.1. Supported PowerShell versions: Windows PowerShell 5.1; PowerShell 7.0+. Included in this version ...
Read more >Changes.txt 2.2.2
Update PSReadLine corresponding to the prediction interface updates (#2225) ... Fix the `ArgumentOutOfRangeException` caused by trimming the command line ...
Read more >about PSReadLine - PowerShell
PSReadLine maintains a history file containing all the commands and data you've entered from the command line. The history files are a file ......
Read more >PSReadLine throw exception after upgrading to PS 7.2
You can fix this by upgrading to the latest 2.2.0-beta4 version of PSReadLine. Instructions for doing so: 1: stop all instances of pwsh....
Read more >PSReadLine Module - PowerShell
In this article. The PSReadLine module contains cmdlets that let you customize the command-line editing environment in PowerShell.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found the issue and also the consistent repro:
Windows
edit mode, runSet-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord
git checkout -b blah origin/nonexist
and press <kbd>Enter</kbd>git ch
, and press <kbd>Ctrl+f</kbd>, then press <kbd>Enter</kbd>The issue will be fixed in #1496 (the 2nd commit).
From @jhoneill