简体   繁体   English

在Raspberry Pi上的.Net Core应用程序中忽略了Console.ReadLine

[英]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. 作为物联网开发的早期尝试,我在.Net Core 2.0 / C#中编写了一个简单的“Hello World”控制台应用程序,并将其部署到运行Windows 10 IoT的Raspberry Pi。

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. 使用Jeremy Lindsay撰写的这篇精彩文章 ,我已将EXE发布到我的PI,然后在PowerShell窗口中远程执行它。 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. 应用程序运行良好,除了一个相当奇怪的问题 - 而不是在输出“Hello World”后等待我按Enter键,它似乎跳过调用Console.ReadLine()并在关闭之前立即显示文本“Terminating”干净。

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. 此问题与PowerShell有关。 You can use SSH as a workaround. 您可以使用SSH作为解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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