在应用程序启动时进行Visual Studio远程调试 [英] Visual Studio remote debugging on application startup

查看:93
本文介绍了在应用程序启动时进行Visual Studio远程调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所了解,使用远程调试器的唯一方法是启动目标应用程序,然后通过Visual Studio将其附加到它。有没有办法从程序的一开始就捕获所有的断点?

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.

推荐答案

如果可以更改代码,请尝试将以下代码行插入应用程序的起点:

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.

这篇关于在应用程序启动时进行Visual Studio远程调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆