[Mono-bugs] [Bug 312172] [2.0] BeginRead on console input blocks program exit

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Aug 6 14:58:57 EDT 2009


User aki.viper at gmail.com added comment

Andrew Kurochka <aki.viper at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |aki.viper at gmail.com

--- Comment #3 from Andrew Kurochka <aki.viper at gmail.com>  2009-08-06 12:58:52 MDT ---
I've checked code above and it really behaves differently on Mono. BeginRead
blocks calling thread. Actually, all BeginXXX methods of Console class are
blocking. The problem is that all standard console streams are created as
FileStream with isAsync flag set to false.

[SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
public static Stream OpenStandardInput (int bufferSize)
    try {
        return new FileStream (MonoIO.ConsoleInput, FileAccess.Read, false,
bufferSize, false /*This argument*/, bufferSize == 0);
    } catch (IOException) {
        return new NullStream ();

As result BeginXXX operations are handled by Stream class which, unlike it's
NET variant, executes them syncroniously.

I've tried to use async versions of FileStream contructors and everything seems
to work and behave fine. Waere there reasons to use sync version of FileStream
constructors? Should it be fixed?

What makes me curious, why Mono variant of the Stream class handles differently
BeginXXX methods?

PS Sorry, for long post, I'm new to Mono codebase and trying not to mess up.

Configure bugmail: http://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