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

If "The ReadKey method reads from the keyboard even if the standard input is redirected to a file with the SetIn method," what causes it to raise an InvalidOperationException. #10717

Open
txwizard opened this issue Dec 1, 2024 · 3 comments
Labels
area-System.Console Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@txwizard
Copy link

txwizard commented Dec 1, 2024

Type of issue

Other (describe below)

Description

Under the Exceptions heading, the cited article states that an InvalidOperationException Exception arises when the standard input stream is directed away from the console. However, the Remarks section states, "The ReadKey method reads from the keyboard even if the standard input is redirected to a file with the SetIn method."

If that is so, the only situation that can give rise to the nvalidOperationException Exception can arise is when the standard input is redirected by a < character in the script, or in the directions given to the CreateProceess Win32 API call that started it.

If my surmise is correct, I suggest that the note under the Exception heading could stand some clarification.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.console.readkey?view=netframework-4.8&devlangs=csharp&f1url=%3FappId%3DDev17IDEF1%26l%3DEN-US%26k%3Dk(System.Console.ReadKey)%3Bk(TargetFrameworkMoniker-.NETFramework%2CVersion%253Dv4.8)%3Bk(DevLang-csharp)%26rd%3Dtrue

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/Console.xml

Document Version Independent Id

34e1ae24-09a1-ba9e-77c3-f2a74ae05769

Article author

@dotnet-bot

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Dec 1, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 1, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 1, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ViktorHofer ViktorHofer added area-System.Console and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 3, 2024
@ViktorHofer
Copy link
Member

cc @dotnet/area-system-console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Console Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants