skip to Main Content

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?

2

Answers


  1. There are couple of ways we can deploy the .Net application onto Raspberry Pi.

    1. Deploying a framework-dependent application
    2. Deploying a self-contained application

    I just want to point that the Blink Led tutorial advises to deploy the project as Self-contained application. If you have followed the same deployment process, make sure you have selected the launch.json template for self-contained process. Please find the below image for reference.

    enter image description here

    The template format varies based on the deployment process and make sure you have used the appropriate one on Visual Studio Code per your needs.

    Note: The launch.json file is only needed if you plan to use Visual Studio Code. If you decide to Debug the application on Raspberry Pi using Visual Studio, you will not need launch.json file. You can debug the app just by installing .Net Run-time on Raspberry Pi and deploy the app again with few configuration changes to start debugging.

    You can download the .Net runtime for Raspberry Pi from the following URL. Please refer the below image to find the distribution I have tested with.

    enter image description here

    Once you download the distribution, follow the steps in the following article to set up and install .Net run time. Once you have successfully installed it, you can verify the version by running dotnet --info on the Raspberry Pi. Here is what the command should return.

    enter image description here

    Once .Net run-time is installed, you can set up your solution using the steps prepare-your-application-for-debugging to build and deploy the application again on to the Raspberry Pi with the configuration changes made (I have deployed the app using the Self-contained app approach)

    After the application is deployed, you can run the application on your Raspberry Pi and debug it in your local machine by following the steps outline here — Attach the debugger

    Find the following images for the configurations I made

    enter image description here

    enter image description here

    enter image description here

    Notice the break point being hit on the Visual Studio after attaching the process.
    enter image description here

    Login or Signup to reply.
  2. 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
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search