Skip to content
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

Console.ReadKey() returning an empty ConsoleKeyInfo.Key for most keys. #107157

Closed
Red-K0 opened this issue Aug 29, 2024 · 2 comments
Closed

Console.ReadKey() returning an empty ConsoleKeyInfo.Key for most keys. #107157

Red-K0 opened this issue Aug 29, 2024 · 2 comments

Comments

@Red-K0
Copy link

Red-K0 commented Aug 29, 2024

Description

When using Console.ReadKey(true) and attempting to read the values in the returned ConsoleKeyInfo, the Key is empty for most keys, specifically any keys not Oem prefixed, not in the numpad, or the LeftWindows key (as far as my testing has gone). This is despite KeyChar always containing the correct key.

Reproduction Steps

This code should suffice with a breakpoint to check the output: ConsoleKeyInfo Key = Console.ReadKey(true);.

Expected behavior

ConsoleKeyInfo.Key should contain values specified in the ConsoleKey enum corresponding to their keys.

Actual behavior

ConsoleKeyInfo.Key contains the value 0 or None.

Regression?

No response

Known Workarounds

No response

Configuration

Using net9.0-windows10.0.22621.0, targeting platform x64.

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Aug 29, 2024
@Red-K0 Red-K0 changed the title Console.ReadKey returning an empty Key for most keys. Console.ReadKey() returning an empty ConsoleKeyInfo.Key for most keys. Aug 29, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-console
See info in area-owners.md if you want to be subscribed.

@Red-K0
Copy link
Author

Red-K0 commented Aug 29, 2024

It seems the issue is caused by enabling VIRTUAL_TERMINAL_INPUT, same as #96490 . Closing this.

@Red-K0 Red-K0 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Aug 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant