Skip to content

PSReadline throws exception when typing commands #4763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
jrjespersen opened this issue May 29, 2025 · 1 comment
Closed
3 tasks done

PSReadline throws exception when typing commands #4763

jrjespersen opened this issue May 29, 2025 · 1 comment

Comments

@jrjespersen
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.5.1
OS: Amazon Linux 2023.7.20250428
BufferWidth: 0
BufferHeight: 0

Last 1 Keys:

 g

### Exception

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Text.StringBuilder.get_Chars(Int32 index)
   at Microsoft.PowerShell.PSConsoleReadLine.ConvertOffsetToPoint(Int32 offset)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Render()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(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, Nullable`1 lastRunStatus)

Screenshot

Image

Environment data

####NOTE: in order to run the commands, I had to first run Remove-Module PSReadLine
PS Version: 7.5.1
PS HostName: ConsoleHost
PSReadLine Version:
PSReadLine EditMode: Emacs
OS: Linux ip-10-120-151-206.intranet.local 6.1.132-147.221.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr  8 13:14:54 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 0
BufferHeight: 0

Steps to reproduce

This is an Amazon Linux 2023 image running in AWS and using Session Manager (through AWS Systems Manager agent) to establish a console session in a browser tab.

  • Connect to instance via Session Manager
  • run pwsh
  • type any character

Expected behavior

command suggestions based on history (or no error if no suggestions available)

Actual behavior

Exception. Additionally, the exception happens every other command (Command 1 attempt fails, command 2 successful, Command 3 attempt fails, etc). Copy/paste of commands makes no difference. Also, no command history is available.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 29, 2025
@jrjespersen
Copy link
Author

Update: I tried to repro this on similarly configured systems and did not encounter the issue again. Additionally, I restarted the system having the issue, and it no longer occurs. Therefore I am closing the issue.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant