c# – Visual Studio 2022 Segmentation Fault when attaching remote debugger to Pi

I’m running a .Net 7 application on a Raspberry Pi running the .Net 7 runtime and SDK.

The application runs fine, but as soon as I attached the remote debugger in Visual Studio 2022 I get a segmentation fault, with no indication of what caused it. I have increased the logging to the maximum.

The only error I receive is on the Pi itself ‘Segmentation Fault’ and an immediate exit with Visual Studio reporting nothing.

To fault find I’ve run and attached the debugger to a new test application which rules out the Pi and my PC, so I know its my application, I’ve also tried it on another Pi.

I then stripped back the code in my application to try and see what is going on and rule out hardware, ethernet comms and serial comms. I find that if I disable my Hosted Services in my Startup.cs file, that the debugger does attach to the application, but this is catching issues because things aren’t initialised, so doesn’t really load fully.

My application communicates with a sensor via serial comms, uses the GPIO on the Pi and uses SignalR to stream data to a front end. I don’t think these are causing the issues, but I don’t know for sure.

Are there any tools, or logs I can look at to try and solve this issue?

Read more here: Source link