Visual Studio中:自动附加到一个进程,当该过程产生了 [英] Visual Studio: auto attach to a process when the process is spawned

查看:832
本文介绍了Visual Studio中:自动附加到一个进程,当该过程产生了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要附加到一个进程(a.exe的),只要它是催生,它是可行的与VS?我只知道进程的名称。其实我想要的东西来完成设置在C#代码中设置断点,但代码是属于将由当前运行的应用程序(c.exe)推出另一个可执行文件。该代码是初始化时期内,因此是不可能的,我做手动附加。

I want to attach to a process(a.exe) as soon as it is spawned, is it doable with VS? I only know the name of the process. Actually what I want to accomplish is set a breakpoint in c# code, but the code is belonging to another executable which will be launched by current running application(c.exe). The code is inside the initialize period so it is impossible for me to do the attach manually.

推荐答案

在我所面临这个情况之前(我控制这两个进程),我找到了一个体面的解决方法是将调用的 Debugger.Launch()。那么VS会弹出一个对话框,让你附加到该进程。

When I've faced this situation before (and I controlled both processes), I found a decent workaround is to put a call to Debugger.Launch() in the spawning process' entry point. VS will then pop up a dialog box and let you attach to the process.

这篇关于Visual Studio中:自动附加到一个进程,当该过程产生了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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