Pete
Pete

Reputation: 1867

Console.ReadLine ignored in .Net Core app on Raspberry Pi

As an early foray into IoT development I've written a simple "Hello World" console app in .Net Core 2.0 / C# and deployed it to a Raspberry Pi running Windows 10 IoT.

static void Main(string[] args)
{
    Console.WriteLine("Hello World");
    Console.ReadLine();
    Console.WriteLine("Terminating");
}

Using this awesome article by Jeremy Lindsay I've published the EXE to my PI and then remotely executed it in a PowerShell window. The app runs fine, asides from one rather odd issue - rather than waiting for me to hit Enter after outputting "Hello World", it seems to skip the call to Console.ReadLine() and immediately displays the text "Terminating" before closing out cleanly.

I can find no reason for this odd behaviour - does anyone have an explanation and is there any way to get this to behave properly?

enter image description here

Upvotes: 5

Views: 253

Answers (1)

Rita Han
Rita Han

Reputation: 9710

This issue looks like related to PowerShell. You can use SSH as a workaround.

Upvotes: 2

Related Questions