在 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

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

问题描述

如果有人能告诉我如何在 raspberry pi 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 上运行

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

所以你想要做的是:

  • 制作你的 hello world 应用
  • 在你想要的地方设置断点
  • 在调试中构建应用程序,自包含
  • 将应用部署到你的 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.

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

这篇关于在 Raspberry Pi 4 上从 Visual Studio 2019 CE 远程调试 Dotnetcore 3.0 - 权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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