C# Mono console app stops output if no key input

I'm seeing an strange behavior on console apps on Mono 4.1 under Linux (Raspbian Jessye, Raspberry Pi 2).

Consider this program:

    static void Main(string[] args)

        while (true)
            if (Console.KeyAvailable)


            Console.SetCursorPosition(0, 0);


It should update the date on screen until a key has been pressed. And it works, during some time near 10 minutes (nearly exact 10 minutes, very round number to be a coincidence it seems to me...), but after that the output freezes, but the program continues running.

I have tested everything and it seems if there is no keyboard input, after some time the console stops refreshing, after any key press the console starts working again for a while and then freezes again.

Obviously this test program stops when a key has been pressed, but on my real program the input is consumed, because that I know the console works again after any key press (I just consume it, I don't do anything with the input). Also I've checked to press any other key like lock num and it also continues working, on the example and on the real program.

Is this a known bug? expected behavior?

Any workaround? I'm creating a console app which monitors some services and is very annoying to have to press a key when I want to see the real data.


Ok, directing my searches to linux and raspberry instead of mono and C# I found my problem.

It comes from two sources, the screen I have attached and the linux console blanking.

I have an SPI screen attached to the rpi and it seems it's drivers are very badly programmed, they have some bugs and one of them is not responding to the blanking (maybe SPI screens aren't aware of it? dunno) so when I saw the console not responding it was because it was blanked and no output was written, I just didn't noticed because the screen weren't cleared at all.

And the blanking, it seems Debian has a bug and even configuring /etc/kbd/config and /boot/config.txt as described here it did not worked, but issuing sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0" as told on the previous link did work, so I created an script to start my app and now it works.

Need Your Help

List available times from 2 DateTimes

.net sql vb.net sql-server-2008

I know this one may come across a little confusing, I'm just trying to contemplating the best way of putting it across! I've posted this on a couple of forums now but I don't seem to be having any ...

JPA: fetch with only a few attributes

java mysql sql jpa

If I were fetching records from a DB, using a SELECT query for example, and need only a few of the attributes (columns), I would do something like: