Remote debugging comes to Rider 2018.3!

The latest Rider 2018.3 Early Access Preview (EAP) build brings remote debugging of .NET, .NET Core and Mono applications! By setting up an SSH connection, we can attach to a running process on a remote machine and step into code.

Better even, remote debugging works across platforms! For example, we can debug a .NET application running on a remote Linux machine, from our Windows box. Let’s see how this works.

Connecting the debugger to a remote server over SSH

With Rider 2018.3, it is now possible to debug a .NET, .NET Core or Mono application that is deployed on a remote machine. From the Run | Attach to Remote Process… menu, we can enumerate processes on a remote server, by connecting to it over SSH.

Of course, we will first have to set up such connection, which can be done from Rider’s settings under Build, Execution, Deployment | Debugger | Remote debug. We can also add a remote host the first time we use Run | Attach to Remote Process… Authentication with a remote host can be done using a password, an OpenSSH / Putty key pair, or using an OpenSSH configuration file and authentication agent.

Setup SSH session for remote debugging with Rider

The first time we now use the Run | Attach to Remote Process… action, Rider can connect to the remote machine and fetch a list of running processes. To do that, it requires the remote debugger tools to be uploaded and extracted on the machine, which can be done automatically.

Load Rider remote debugger tools on external machine

Note that when the unzip tool is installed on the remote machine, Rider will compress (and extract) the remote debugger tools to increase transfer speed.

Once we select a remote process, Rider will attach the debugger to it and allows us to pause execution, place breakpoints, inspect variables, and so on.

Once the remote debugger tools have been loaded first time, connecting to a remote host becomes much easier. Again using the Run | Attach to Remote Process… action, Rider now immeditaly lists remote processes and lets us attach to them:

Attach debugger to remote process in Rider and inspect variables

Once we select a remote process, Rider will attach the debugger to it and allows us to pause execution, place breakpoints, and so on.

Other debugger updates

Next to adding support for remote debugging, we have made a number of bugfixes and improvements to the debugger:

  • We added a new expression evaluation engine, which lets us use the latest C# syntax in debugger watches.
  • When inspecting variables, the context menu now lets us switch between decimal and hexadecimal for numeric values.
  • Support of pointer operations (arithmetic, derefencing) in watches for .NET, .NET core, Mono and Unity 2018.3+ (when the new runtime is used) is coming in the next EAP build

Download Rider 2018.3 EAP and give it a try! We’d love to hear your feedback!

This entry was posted in How-To's and tagged , , . Bookmark the permalink.

35 Responses to Remote debugging comes to Rider 2018.3!

  1. Can I use this to debug an IIS application running on a Windows Server?

  2. Pingback: Dew Drop - November 30, 2018 (#2850) - Morning Dew

  3. jd says:

    Nice move. Any update on this one ?
    https://youtrack.jetbrains.com/issue/RIDER-2704

    Regards

  4. Eli says:

    This is really cool to have, just one thing that is unclear to me, what setup is required on the server (besides ssh ofc)

  5. Piotr says:

    Can I debug a .NET application on a remote Windows machine? My local machine runs on Linux.

  6. Pavel says:

    Super awesome! .NET diagnostic tooling is really lacking on Linux, it is a pain sometimes. Great step in that direction!

  7. Nickie S. says:

    Are there any plans for adding copying functionality, so I can edit, build and debug program without leaving IDE?

  8. Bob Gonsalves says:

    Will this effectively replace the Attach to Android Process that was in MonoDevelop? Any chance we can get a tutorial on how to do that?

  9. ydrolet says:

    Thank you very much for this great feature! Does the remote debugger tools that are uploaded to the remote machine support ARM? I would like to remote debug .NET Core program on a Raspberry Pi. Is it possible? If not, do you have plans to support ARM in the future?

  10. on3al says:

    Did this functionality make it into the released version? Is this functionality available when running Rider on OSX?

  11. George says:

    Can we use remote Debugging to debug a local docker container built from a docker-compose.yml?

    I am able to actually hit the container using the “Attach to remote Process” feature at root@127.0.0.1:port

    But i get a:

    info: Microsoft.AspNetCore.Server.Kestrel[17]
    api_1 | Connection id “0HLLBKT2RMC3P” bad request data: “Invalid request line: ‘SSH-2.0-JSCH-0.1.54\x0A'”
    api_1 | Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid request line: ‘SSH-2.0-JSCH-0.1.54\x0A’
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser1.RejectRequestLine(Byte* requestLine, Int32 length)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser
    1.GetUnknownMethod(Byte* data, Int32 length, Int32& methodLength)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser1.ParseRequestLine(TRequestHandler handler, Byte* data, Int32 length)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser
    1.ParseRequestLine(TRequestHandler handler, ReadOnlySequence1& buffer, SequencePosition& consumed, SequencePosition& examined)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser
    1.Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpParser.ParseRequestLine(TRequestHandler handler, ReadOnlySequence1& buffer, SequencePosition& consumed, SequencePosition& examined)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TakeStartLine(ReadOnlySequence
    1 buffer, SequencePosition& consumed, SequencePosition& examined)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ParseRequest(ReadOnlySequence1 buffer, SequencePosition& consumed, SequencePosition& examined)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication
    1 application)
    api_1 | at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

    I am not sure this is a rider issue, a docker issue, or a dotnet core setup issue.

  12. vb says:

    Is Edit and continue is supported

  13. Is there a way to debug a Docker image running in a Kubernetes pod? I can open a shell using

    kubectl exec -it POD_NAME — /bin/bash

    but how can I tell Rider to use that to connect?

Leave a Reply

Your email address will not be published. Required fields are marked *