[Mono-dev] Problem with Console.In.Peek() [hungs]

Manfred Braun manfred.braun at manfbraun.de
Fri May 5 18:59:57 EDT 2006

Hi All!

I am new on the road to make some things on my Unix box [which is NetBSD 3.0/i386] and I started using some simple console programs. My problem is, that the method "Console.In.Peek()" hungs, if no input stream is provided and I just execute the application. If I pipe over like "echo 'a' | mono ct.exe"
everything is like expected, even, if I provide an empty file. The simple proggi is at the end.

I think there are several different problems ;-)
It looks like the code is relatively strong copied over from MS/.Net, which has the same bug [I am just requiring support from them]. The background is also complicated:MS has another concept for consoles like unix. So no wonder, that MS has the Console.In/Out implemented as TextReader and not as some stream [which would have a property like "EndOfStream"] and there is no way to make a connection between that, what the console is and a device, like the keyboard and or the screen/terminal. MS has also not implemented the events which are associates with real Win32 programs [for <ctrl-C> for example]. The console class is not properly isolated from the underlying OS. Does Mono implement the usual signals for processes so far?

Would be great to hear some informations about this.

Thanks and
best regards,

=== +++ codesnippet +++ ===
//ct.cs (ConsoleTest)

using System;

namespace buggy
        public class CT
                public static void Main()
                        Console.Error.WriteLine("?{0}", Console.In.Peek());

More information about the Mono-devel-list mailing list