简体   繁体   English

.NETCore应用程序因StackOverflowException而终止

[英].NETCore Application terminating due to StackOverflowException

So, 所以,

I'm using a Raspberry Pi model 3b and i have successfully got .NetCore v2.0.1 running on it. 我正在使用Raspberry Pi模型3b,我已成功运行.NetCore v2.0.1。 I have been able to build the CoreIOT Hello World project and ran it without problem on my Pi now i have some custom hardware i have created using the GPIO board and the only way i could think to use it in .NETCore was to use the FileSystem method /sys/class/gpio I have built a very small app 我已经能够构建CoreIOT Hello World项目并在我的Pi上运行它没有问题现在我有一些使用GPIO板创建的自定义硬件,我认为在.NETCore中使用它的唯一方法是使用FileSystem method /sys/class/gpio我已经构建了一个非常小的应用程序

https://github.com/barkermn01/CanReader https://github.com/barkermn01/CanReader

There is not much in there but for some reason when i run the app all i get is a message saying Proccess is terminating due to StackOverflowException I'm not sure what is causing it there is nothing in there too big i don't think just basic file system reading. 没有多少,但由于某种原因,当我运行应用程序所有我得到的消息说Proccess is terminating due to StackOverflowException我不知道是什么导致它没有什么在那里太大我不认为只是基本文件系统读取。

The only thing i can think of is it does not like the infinite loops 我唯一能想到的是它不喜欢无限循环

From: https://github.com/barkermn01/CanReader/blob/master/Program.cs 来自: 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;
    }
}

and From: https://github.com/barkermn01/CanReader/blob/master/GPIOWatcher.cs 和来自: 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);
    }
}

Check the property getter of GPIO.FullPath which accesses itself: 检查访问自身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