【问题标题】:How can I debug a process in WSL2 from Rider?如何从 Rider 调试 WSL2 中的进程?
【发布时间】:2021-09-30 16:36:17
【问题描述】:

我想调试在 WSL2 下运行的 .NET Core 进程,但我无法从 Windows 中的 Rider 附加到它。有没有办法做到这一点?

【问题讨论】:

    标签: c# debugging wsl-2 rider


    【解决方案1】:

    您可以将您的 WSL2 发行版视为远程机器,并使用 Rider 的远程调试工具来实现此目的。说明基本上遵循此处记录的内容:https://www.jetbrains.com/help/rider/SSH_Remote_Debugging.html#set-up-ssh-server-on-the-remote-machine

    在您的 wsl2 控制台中:

    $ # fetch the jetbrains debug agent
    $ cd ~
    $ wget -o jetbrains-debug-agent https://www.jetbrains.com/help/rider/SSH_Remote_Debugging.html#set-up-ssh-server-on-the-remote-machine
    $ chmod +x jetbrains-debug-agent
    $ ./jetbrains-debug-agent
    Please, use these credentials to establish SSH connection
    Login:  xxxxxxxx
    Password:  xxxxxxxxxxxxxxx
    Port:  1234
    
    $ # then determine your local IP address
    $ ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.11.60  netmask 255.255.240.0  broadcast 192.168.15.255
    ...
    
    $ # then, in Rider, choose Run > Attach To Remote Process
    $ # it'll ask you to setup connection details for the remote machine
    $ # it'll tell you that it needs to install remote debug components; you'll need to agree
    $ # then attach ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多