> For the complete documentation index, see [llms.txt](https://nicologies.gitbook.io/awesome-programming-knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nicologies.gitbook.io/awesome-programming-knowledge/troubleshooting/debugging/visual-studio-debugging-tricks-and-tips/remote-debugging.md).

# Remote Debugging

Sometimes you own PC may not have the environment (e.g. hardware) to debug an application, in this case you may want to debug the application running on another device.

In summary you'll need the debugger on your local machine, an debugger agent on the remote machine. You can debug Native C++, Managed .NET code, and also mixed projects.

## Connectivity to the Remote Machine

Make sure your PC can connect to the remote machine over network, so can Visual Studio.

## Remote Debugging Agent

Install `Remote Tools for Microsoft Visual Studio 2013`(Assuming Visual Studio 2013 is used for debugging) on the remote machine.

Once installed, you should be able to find it from the start menu:

![](https://802335433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS-Lr-k8ca7XeqESs7Z%2F-LS-M8pp9z3hHomnOISh%2F-LS-MHurP4xw8_VUzWAi%2FVisualStudioRemoteDebugAgent.png?generation=1542973114985998\&alt=media)

Now right click and run the `Remote Debugger` as admin, and select the `Tools` -> `Options` menu to configure the authentication.

![](https://802335433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS-Lr-k8ca7XeqESs7Z%2F-LS-M8pp9z3hHomnOISh%2F-LS-MHutSRO83hozaRwE%2FRemoteAgentConfigurationMenus.png?generation=1542973114852009\&alt=media)

![](https://802335433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS-Lr-k8ca7XeqESs7Z%2F-LS-M8pp9z3hHomnOISh%2F-LS-MHuvKcXDU5jumdL5%2FRemoteDebugAgentAuthentication.png?generation=1542973114864839\&alt=media)

Here I'm using `No Authentication` as security is not a concern and I'm going to use the agent for a very short time in intranet.

You may also want to increase the idle time otherwise the agent will stop working after the idle time.

## Run the Target Application

* Compile your code, better to use debug version, but release version (code optimized) with PDB is also OK if you have no choice for example the application only crashes in release mode
* Copy assembly to the target machine
* Start the application as you normally do

## Debug in Visual Studio

Back to your local machine, open Visual Studio and the solution of the code of course.

Version:0.9 StartHTML:0000000221 EndHTML:0000001057 StartFragment:0000000257 EndFragment:0000001021 SourceURL:<https://helixleisure.atlassian.net/wiki/spaces/EM/pages/166363307/Debugging+Remotely+using+Visual+Studio>

* Select the`Debug -> Attach To Process`
* Select`Remote (no authentication)`(up to the Authentication method you've configured previously) as the Transport, put the IP of the remote machine into the`Qualifier`text box (e.g `172.16.10.61`) and press the`Refresh`button. You need to tick the `Show processes from all users` if the application was started by another user rather than the one who started the remote debug agent.
* Select application from the list and press the `Attach` to start debugging

![](https://802335433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS-Lr-k8ca7XeqESs7Z%2F-LS-M8pp9z3hHomnOISh%2F-LS-MHux7zfxeE3CD9nZ%2FRemoteDebugProcessSelection.png?generation=1542973115573189\&alt=media)
