簡體   English   中英

.NETCore應用程序因StackOverflowException而終止

[英].NETCore Application terminating due to StackOverflowException

所以,

我正在使用Raspberry Pi模型3b,我已成功運行.NetCore v2.0.1。 我已經能夠構建CoreIOT Hello World項目並在我的Pi上運行它沒有問題現在我有一些使用GPIO板創建的自定義硬件,我認為在.NETCore中使用它的唯一方法是使用FileSystem method /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);
    }
}

檢查訪問自身GPIO.FullPath屬性getter

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM