dotnet / dotnet/dotnet-api-docs

Console.Readkey() behaviour differences between platforms not documented.

Open
#7,543 2 comments 0 reactions 0 assignees View on GitHub
area-System.Console help wanted Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

**Issue description**
`Console.ReadKey(true).Key` with Numpad keys behaves differently between Windows and Linux. This should be documented.

For example:
`Console.WriteLine(Console.ReadKey(true).Key);` Pressing the "Numpad 1" key:
On Windows returns `NumPad1`
On Linux (Ubuntu) returns `D1` ie. the same as 1 on the number row.

This behavioral difference should be mentioned in the docs since it caused quite a bit of confusion.

**Target framework**

- [x] .NET Core - .NET 6.0.1
- [ ] .NET Framework
- [ ] .NET Standard

dotnet --info output or About VS info

```console
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a

Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.101/

Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc

.NET SDKs installed:
6.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.