Bug 15118 - Console read methods messes up terminal after program finishes
Summary: Console read methods messes up terminal after program finishes
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-10-02 04:07 UTC by Igor Kostromin
Modified: 2016-11-28 03:16 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Test application code and screenshot (120.60 KB, application/octet-stream)
2013-10-02 04:07 UTC, Igor Kostromin

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Igor Kostromin 2013-10-02 04:07:56 UTC
Created attachment 5037 [details]
Test application code and screenshot

If using ncurses library and call one of read methods (Console.ReadLine(), Console.ReadKey() or Console.KeyAvailable) inside ncurses block

... <- somewhere here

then terminal will be messed up (its settings will be broken). To restore it user can use a `stty sane` command.

Found workaround: if call Console.KeyAvailable BEFORE ncurses initialization, all works fine:

bool ignored = Console.KeyAvailable;
... <- using or not using read methods
Comment 1 Miguel de Icaza [MSFT] 2016-11-28 03:16:26 UTC
This is expected, as Console will restore the settings that it read previously and will not know that you changed those behind its back.