-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
ReadConsoleInput
can read 0 characters and return success and it almost certainly shouldn't
#15859
Comments
No actually, it's gonna be super easy, barely an inconvenience. 1
terminal/src/host/readDataDirect.cpp Line 138 in d4d59fa
But if we compare that with the conhost v1 code where the callback was a function called !(a->Flags & CONSOLE_READ_NOWAIT) Which I think is the expected behavior. In other words, I believe that this is a conhost v1 -> v2 regression. Footnotes |
ReadConsoleInput
can read 0 characters and return success and we're just not sure if that's by-designReadConsoleInput
can read 0 characters and return success and it almost certainly shouldn't
This change fixes a problem where Console.ReadKey inappropriately throws an InvalidOperationException. The Console.ReadKey function can throw an InvalidOperationException when the "application does not have a console or when console input has been redirected". That makes sense. However, there is *another* case where it throws an InvalidOperationException, which happens when there are multiple processes attached to the same console, which are waiting for input, and one dies or is killed. In this case, the native read function returns a "success" return code, but the "out" parameter indicating the number of records read is 0, and in this case, Console.ReadKey is throwing, but it should not be. Note that this behavior of the underlying platform is "almost certainly" a bug (microsoft/terminal#15859); however, it is longstanding behavior, so we would like to avoid blowing up apps who have the misfortune of stumbling into this situation. More details in the linked Issue: Fix dotnet#88697
This change fixes a problem where Console.ReadKey inappropriately throws an InvalidOperationException. The Console.ReadKey function can throw an InvalidOperationException when the "application does not have a console or when console input has been redirected". That makes sense. However, there is *another* case where it throws an InvalidOperationException, which happens when there are multiple processes attached to the same console, which are waiting for input, and one dies or is killed. In this case, the native read function returns a "success" return code, but the "out" parameter indicating the number of records read is 0, and in this case, Console.ReadKey is throwing, but it should not be. Note that this behavior of the underlying platform is "almost certainly" a bug (microsoft/terminal#15859); however, it is longstanding behavior, so we would like to avoid blowing up apps who have the misfortune of stumbling into this situation. More details in the linked Issue: Fix #88697
…98684) This change fixes a problem where Console.ReadKey inappropriately throws an InvalidOperationException. The Console.ReadKey function can throw an InvalidOperationException when the "application does not have a console or when console input has been redirected". That makes sense. However, there is *another* case where it throws an InvalidOperationException, which happens when there are multiple processes attached to the same console, which are waiting for input, and one dies or is killed. In this case, the native read function returns a "success" return code, but the "out" parameter indicating the number of records read is 0, and in this case, Console.ReadKey is throwing, but it should not be. Note that this behavior of the underlying platform is "almost certainly" a bug (microsoft/terminal#15859); however, it is longstanding behavior, so we would like to avoid blowing up apps who have the misfortune of stumbling into this situation. More details in the linked Issue: Fix dotnet#88697
…98684) This change fixes a problem where Console.ReadKey inappropriately throws an InvalidOperationException. The Console.ReadKey function can throw an InvalidOperationException when the "application does not have a console or when console input has been redirected". That makes sense. However, there is *another* case where it throws an InvalidOperationException, which happens when there are multiple processes attached to the same console, which are waiting for input, and one dies or is killed. In this case, the native read function returns a "success" return code, but the "out" parameter indicating the number of records read is 0, and in this case, Console.ReadKey is throwing, but it should not be. Note that this behavior of the underlying platform is "almost certainly" a bug (microsoft/terminal#15859); however, it is longstanding behavior, so we would like to avoid blowing up apps who have the misfortune of stumbling into this situation. More details in the linked Issue: Fix dotnet#88697
More discussion notes in dotnet/runtime#88697. I'm filing this here so we have a local reference to the discussion, even if we just close this out.
Here are some miscellaneous noted comments from that thread:
The text was updated successfully, but these errors were encountered: