.net core 3.1 remote debugging from VS 2019 CE to Raspberry PI - vsdbg exits when the app wants to handle a GPIO-interrupt

Viewed 159

My App handles GPIO interrupts on a Raspberry PI 3B+ using the Unosquare.Raspberry.IO and Unosquare.WiringPi nuget packages. Since it has to handle multiple interrupts, it sets up a task for each of them and then waits on the resulting task list.

The setup for the interrupt is as follows:

   public async Task StartCounterAsync(CancellationToken cancelToken)
    {
        logger.LogInformation($"Starting Counter {counterName}");

        var counterPin = Pi.Gpio[inputPin];
        counterPin.PinMode = GpioPinDriveMode.Input;

        counterPin.RegisterInterruptCallback(EdgeDetection.RisingEdge, HandleCounterInterrupt);

        await cancelToken;
    }

    private void HandleCounterInterrupt()
    {
        logger.LogInformation("HandleCounterInterrupt");
    }
}

When I launch the application via ssh on the raspi, the application runs fine and the interrupt handling works without any problems. If I launch the application via "DebugAdapterHost.Launch /LaunchJson:launch.json" it runs fine until I press the button to create the interrupt. Then vsdgb simply exits:

 1> [DebugAdapter] <--   E (thread): {"seq":97,"type":"event","event":"thread","body":{"reason":"started","threadId":1340}}
*** Here I press the button ***
 1> [DebugAdapter] <--   E (exited): {"seq":98,"type":"event","event":"exited","body":{"exitCode":0}}
 1> [DebugAdapter] <--   E (terminated): {"seq":99,"type":"event","event":"terminated","body":{}}
 1> [DebugAdapter] --> C (disconnect-15): {"type":"request","command":"disconnect","arguments":{},"seq":15}

I have tried this with vsdbg running as a normal user and running as root with the same result. This is no crash, vsdbg just exits. A breakpoint inside HandleCounterInterrupt() is never reached.

Environment:

Launch.json (with root setup):

{
  "version": "0.2.0",
  "adapter": "plink.exe",
  "adapterArgs": "-i C:/Users/ur/source/repos/devpikey.ppk root@devpi -batch -T /home/pi/vsdbg/vsdbg --interpreter=vscode",
  "configurations": [
    {
      "name": ".NET Core Launch",
      "type": "coreclr",
      "cwd": "/home/pi/PiS0Counter",
      "program": "/home/pi/dotnet-arm32/dotnet",
      "args": "PiS0Counter.dll",
      "request": "launch"
    }
  ]
}
0 Answers
Related