gpt4 book ai didi

c# - .NETCore 应用程序因 StackOverflowException 而终止

转载 作者:行者123 更新时间:2023-11-30 13:35:50 25 4
gpt4 key购买 nike

所以,

我使用的是 Raspberry Pi 型号 3b,并且我已成功在其上运行 .NetCore v2.0.1。我已经能够构建 CoreIOT Hello World 项目并在我的 Pi 上毫无问题地运行它,现在我有一些使用 GPIO 板创建的自定义硬件,我认为在 .NETCore 中使用它的唯一方法是使用 FileSystem方法 /sys/class/gpio 我构建了一个非常小的应用程序

https://github.com/barkermn01/CanReader

里面没有太多内容,但出于某种原因,当我运行该应用程序时,我得到的只是一条消息,内容为 Proccess is terminating due to StackOverflowException 我不确定是什么原因导致的,没有任何内容里面太大了,我不认为只是基本的文件系统读取。

我唯一能想到的是它不喜欢无限循环

发件人:https://github.com/barkermn01/CanReader/blob/master/Program.cs

while (!exiting)
{
Console.Write("\rCurrent State " + state);
string input = Console.ReadLine();
if (input == "exit")
{
watcher.Stop();
exiting = true;
}
}

来自:https://github.com/barkermn01/CanReader/blob/master/GPIOWatcher.cs

public void watch()
{
GPIO.Value val = Gpio.ReadValue();
while (val != OldValue)
{
val = Gpio.ReadValue();
if (Delegate != null)
{
Delegate.DynamicInvoke();
}
Thread.Sleep(10);
}
}

最佳答案

检查 property getter of GPIO.FullPath它访问自己:

   /// <summary>
/// Generates the full path for the Filesystem mappings for this GPIO pin
/// </summary>
public string FullPath
{
get
{
return this.Path + "/" + this.FullPath;
}
}

关于c# - .NETCore 应用程序因 StackOverflowException 而终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45827872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com