在应用程序启动时进行Visual Studio远程调试

编程入门 行业动态 更新时间:2024-10-04 23:28:05
本文介绍了在应用程序启动时进行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远程调试

本文发布于:2023-11-03 04:14:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554213.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   应用程序   Studio   Visual

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!