rudisoft
rudisoft

Reputation: 13

Dotnetcore 3.0 remote debugging from visual studio 2019 CE on Raspberry Pi 4 - insufficient rights

If there was anyone who could tell me how to remote debug a dotnetcore 3.0 console app from visual studio 2019 CE on a raspberry pi 4, I'd be happier.

plink -ssh -pw raspberry [email protected] "curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -r linux-arm -v latest -l ~/vsdbg"

is installed and runs on the PI

using Iot.Device.CpuTemperature;
using System;
using System.Device.Gpio;
using System.Threading;
namespace Raspi
{
    class Program
    {
        static void Main(string[] args)
        {
            CpuTemperature temp = new CpuTemperature();
            GpioController ctrl = new GpioController();
            int pin = 4;
            int wait = 5000;
            ctrl.OpenPin(pin, PinMode.Output);
            Console.WriteLine("Hello World!");
            int counter = 0;
            while (true)
            {
                Console.WriteLine($"The CPU temperature is {temp.Temperature.Celsius}");
                Console.WriteLine("counter=" + counter++);
                ctrl.Write(pin, PinValue.High);
                Thread.Sleep(wait);
                ctrl.Write(pin, PinValue.Low);
                Thread.Sleep(wait);
            }
        }
    }
}

Compiles without errors. Here some screenshots of the error behaviour:

vsbdg runs under root account
vsdbg can be found while browsing via ssh
And this error comes up
(translated from German) Error while connecting to the process: The .net debugger (vsdbg) doesn't have sufficient rights to debug the process. In order to debug the process, 'vsdbg' must be executed using root rights.

Upvotes: 1

Views: 1734

Answers (1)

Lewis Cianci
Lewis Cianci

Reputation: 1065

You can debug over SSH in Visual Studio.

So what you want to do is effectively this:

  • Make your hello world app
  • Set breakpoints in it where you want them
  • Build the app in debug, self contained
  • Deploy the app to your Rapberry Pi (it has to have SSH enabled on the Pi, running something like Raspbian)
  • Attach your debugger from VS 2019 to the Pi over SSH.

I wrote a longer article explaining exactly what I did here. It's the friend link so you don't get hit with Medium's paywall. It also means we're friends now.

https://medium.com/@lewwybogus/debugging-your-net-core-3-app-on-your-raspberry-pi-with-visual-studio-2019-9662348e79d9?source=friends_link&sk=33e0da85e07e45234a7804d5801110a1

Upvotes: 2

Related Questions