Skip to content

'Delete' can cause 'ArgumentOutOfRangeException' when used with 'Alt+Num' #1278

@daxian-dbw

Description

@daxian-dbw

Environment data

PS version: 7.0.0-rc.1
PSReadline version: 2.0.0-rc1
os: 10.0.18362.1 (WinBuild.160101.0800)
PS file version: 7.0.0.0
HostName: ConsoleHost
BufferWidth: 145
BufferHeight: 9001

Steps to reproduce or exception report

  1. run Set-PSReadLineOption -EditMode Windows
  2. type a
  3. type LeftArrow
  4. type Alt+2
  5. press Delete (exception will be thrown)

Exception

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
   at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)
   at Microsoft.PowerShell.PSConsoleReadLine.DeleteCharImpl(Int32 qty, Boolean orExit)
   at Microsoft.PowerShell.PSConsoleReadLine.DeleteChar(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.DigitArgument(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)

Metadata

Metadata

Assignees

Labels

Issue-BugIt either shouldn't be doing this or needs an investigation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions