在Raspberry Pi 4上从Visual Studio 2019 CE进行Dotnetcore 3.0远程调试-权限不足 [英] Dotnetcore 3.0 remote debugging from visual studio 2019 CE on Raspberry Pi 4 - insufficient rights

查看:225
本文介绍了在Raspberry Pi 4上从Visual Studio 2019 CE进行Dotnetcore 3.0远程调试-权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人可以告诉我如何在树莓派4上从Visual Studio 2019 CE远程调试dotnetcore 3.0控制台应用程序,我会更开心的.

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 pi@raspberrypi.local "curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -r linux-arm -v latest -l ~/vsdbg"

已安装并在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在根帐户下运行
通过ssh浏览时可以找到 vsdbg
出现此错误
(从德语翻译)连接到进程时出错:.net调试器(vsdbg)没有足够的权限来调试进程.为了调试该过程,必须使用根权限执行"vsdbg".

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.

推荐答案

您可以在Visual Studio中通过SSH进行调试.

You can debug over SSH in Visual Studio.

所以您要做的实际上是这样:

So what you want to do is effectively this:

  • 制作您好的世界应用
  • 在所需的位置设置断点
  • 以调试,独立的方式构建应用
  • 将应用程序部署到您的Rapberry Pi(必须在Pi上启用SSH,并运行Raspbian之类的东西)
  • 通过SSH将调试器从VS 2019安装到Pi上.

我写了一篇更长的文章,确切解释了我在这里所做的事情.这是朋友链接,因此您不会被Medium的付费专区所吸引.这也意味着我们现在是朋友.

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.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆