How can I debug a process in WSL2 from Rider?
Asked Answered
P

1

9

I'd like to debug my .NET Core process running under WSL2, but I can't attach to it from Rider in Windows. Is there a way to achieve this?

Possibly answered 30/9, 2021 at 16:36 Comment(0)
P
11

You can treat your WSL2 distribution as a remote machine and use Rider's remote debugging tools to achieve this. The instructions basically follow what's documented here: https://www.jetbrains.com/help/rider/SSH_Remote_Debugging.html#set-up-ssh-server-on-the-remote-machine

In your wsl2 console:

$ # 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 ...
Possibly answered 30/9, 2021 at 16:36 Comment(2)
Is it anyhow possible to setup deployment and process start via Rider?Haematoxylon
It might be possible, possibly with the "IDE scripting console" - but tbh it's not something I've done. I'd be interested to know if someone has.Possibly

© 2022 - 2024 — McMap. All rights reserved.