Search code examples
.netazureraspberry-piazure-iot-hubvscode-remote

Debug .NET apps on Raspberry Pi - dotnet has exited with code 0


I have a question regarding debugging in VS Code. I have created simple console app. I deployed the solution to a Raspberry PI, connected via SSH, and ran the app. It worked.

I would like to use the debugger with this solution. I tried to configure launch.json as specified here: Debug .NET apps on Raspberry Pi but I get an error message:

"Loaded '/home/myuser/.dotnet/shared/Microsoft.NETCore.App/7.0.0/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[5362] dotnet' has exited with code 0 (0x0)."

I have installed dotnet and as I said it works when I run it manually once I am connected via SSH.

This is my configuration from lanuch.json (I changed username and host)

{
  "version": "1.0.0",
  "configurations": [
    {
      "name": ".NET Remote Launch - Framework-dependent",
      "type": "coreclr",
      "request": "launch",
      "program": "~/.dotnet/dotnet",
      "args": ["~//dev/iot/soil-moisture/SoilMoisture.dll"],
      "cwd": "~/dev/iot/soil-moisture/",
      "stopAtEntry": false,
      "console": "internalConsole",
      "pipeTransport": {
        "pipeCwd": "${workspaceRoot}",
        "pipeProgram": "ssh",
        "pipeArgs": ["username@host"],
        "debuggerPath": "~/vsdbg/vsdbg"
      }
    }
  ]
}

I'm not sure what I am doing wrong or what to try next?


Solution

  • I'm the author of the doc you linked. I found this question while I was looking for a solution for that same problem, so I reckon you're not alone.

    I'm trying to figure out why it's not working, and I think I've tracked down the person to talk to. In the meantime, I've isolated the issue to .NET 7 apps on linux-arm.

    I'll update the doc in a day or two when I figure out why it's broken. So your possible workarounds (for the moment) are any one of the following:

    • Run Raspberry Pi OS 64-bit
    • Target .NET 6.0