Debugger.Launch不工作 [英] Debugger.Launch not working

查看:306
本文介绍了Debugger.Launch不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为外部启动的进程启动调试器(而不是从visual studio中启动)。我似乎无法让调试器实际上启动,因为它似乎没有发生什么。在这个过程中,我添加了这个代码:

I am currently trying to launch a debugger for a process that is launched externally (not from within visual studio). I cannot seem to get a debugger actually launch, as it appears nothing happens. In the process, I added this code:

Debug.Assert(Debugger.IsAttached == false, "Should be no debugger");
if (!Debugger.IsAttached)
{
    Debug.Assert(Debugger.Launch(), "Debugger not launched");
}
Debugger.Break();
Debug.Assert(Debugger.IsAttached == true, "Debugger should be attached");

断言是为了验证我不疯狂。首先, IsAttached 属性按预期返回false。然后调用 Debugger.Launch ,返回 true 。根据 Debugger.Launch 的MSDN文档,它表示如果成功启动调试器,或者如果已经连接调试器,它将返回true。我验证了一个没有附加,所以它必须已经启动了一个。

The asserts are there to verify that I'm not crazy. At first, the IsAttached property returns false as I expect. I then call Debugger.Launch, and that returns true. As per the MSDN documentation of Debugger.Launch, it says it will only return true if it succeeds in launching the debugger, or if one is already attached. I verified one was not attached, so it must have launched one.

断点从不被击中,第二个验证失败( IsAttached property返回false)。我还试图在调用Debugger.Launch 之后进入睡眠状态,给它一些时间,无济于事。

The break-point never gets hit, and the second verify fails (the IsAttached property returns false). I also attempted to put a sleep in after Debugger.Launch to give it some time, to no avail.

任何建议? >

Any suggestions?

推荐答案

答案: Visual Studio 2010 Express

Express不支持(没有一定程度的骇客)附加到一个进程来调试它。这意味着即时调试功能可用。我认为这也是什么导致Debugger.Launch失败(虽然它返回true,我假设是因为它技术上试图显示一个对话框,但没有安装调试器)。

Express does not support (without a level of hackery) attaching to a process to debug it. This means that the Just In Time Debugging features are not available. I assume this is also what causes the Debugger.Launch to fail (though it returns true, and I'm assuming that's because it technically attempted to show a dialog, but no debuggers were installed).

这篇关于Debugger.Launch不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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