[Mono-bugs] [Bug 417061] [Win32] Console.ReadKey() does not actually wait for input

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Aug 13 13:25:46 EDT 2008


User imphasing at gmail.com added comment

Alex Fort <imphasing at gmail.com> changed:

           What    |Removed                                         |Added
                 CC|                                                |imphasing at gmail.com

--- Comment #1 from Alex Fort <imphasing at gmail.com>  2008-08-13 11:25:46 MDT ---
I've been looking into this bug, and I think I've identified what's happening.

In the constructor for ConsoleDriver(class/corlib/System/ConsoleDriver.cs), the
IsConsole property is being set to false, which causes a NullConsoleDriver to
be created instead of a WindowsConsoleDriver. Since ReadKey in
NullConsoleDriver just returns a ConsoleKeyInfo.Empty, there is no waiting for
user input.

Upon further investigation, by setting IsConsole to true, I can call
WindowsConsoleDriver.ReadKey, but it throws an exception, because
ReadConsoleInput (class/corlib/System/WindowsConsoleDriver.cs) returns false.
GetLastWin32Error returns "6" in this case, but that seems a bit cryptic. I'm
not sure what's causing ReadConsoleInput (kernel32.dll) to return false, but
I'm still looking into this.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list