简体   繁体   中英

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?

在此输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM