Skip to content

Console.ReadKey() doesn't work for keys from the numeric keypad in the PuTTY ssh client #25735

@daxian-dbw

Description

@daxian-dbw

Original issue: PowerShell/PowerShell#10511

We got report that when ssh from PuTTY to a Linux machine and start pwsh on the server side, pwsh doesn't support the numeric keypad.
It turns out to be an issue with Console.ReadKey and the PuTTY client, see PowerShell/PowerShell#10511 (comment). Quoted below:

This is an issue in .NET Core, as Console.ReadKey() generates unexpected ConsoleKeyInfo for key pressing from numeric keypad when ssh'ed through PuTTY.
For example, you will the following when pressing 0 on the numeric keypad:

PS:1> [System.Console]::ReadKey()
O
KeyChar Key  Modifiers
------- ---  ---------
     O   O Alt, Shift

That PowerShell doesn't handle the keypad is one thing, but that it messes it up for everyone else is Real Bad(tm).

It's messed up by the .NET Core runtime. As soon as you start any dotnet application, you will be left in this "Real Bad" situation.
For example, just run pwsh -help, which only prints out the help content and exit. Then you will find all keypad keys are non-functional in bash.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions