Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio remote debugging on application startup

As I understand it now, the only way to use the remote debugger is to start the target application, and then attach to it through Visual Studio. Is there a way to capture all of the breakpoints from the very beginning of the program?

There is code within my program that I need to debug, and I can never get the debugger attached fast enough to capture that executing code.

like image 545
Tim Avatar asked Mar 27 '12 20:03

Tim


People also ask

How do I Debug a remote app in Visual Studio?

Select Configure remote debugging to configure the firewall and start the remote debugger. When configuration is complete, the Remote Debugger window appears. The remote debugger is now waiting for a connection. Use the server name and port number shown to set the remote connection configuration in Visual Studio.

How do I enable remote debugging for app services?

Right-click your app in the App Service explorer and select Start Remote Debugging. This process requires that the app be restarted with the debugger enabled - you'll be prompted to confirm the restart.


Video Answer


1 Answers

If you can change the code, try injecting this line of code in the starting point of your app:

System.Diagnostics.Debugger.Launch(); 

When this line is hit it will prompt you to attach a debugger, effectively waiting for you to respond. Since you are using a remote debugger you should be able to attach at that point and then just cancel the dialog. Hope this helps.

like image 143
BenR Avatar answered Oct 10 '22 23:10

BenR