VS2010添加调试器事件未触发

时间:2011-11-11 04:41:53

标签: c# visual-studio-2010 visual-studio-addins

我正在尝试为VS2010开发一个捕获DebuggerEvents.OnExceptionThrown事件的插件,但由于某种原因它永远不会被处理。这是一些不起作用的简单代码:

private DebuggerEvents debuggerEvents;

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{

//Boilerplate code snipped out
    if (debuggerEvents == null)
    {
        //This fails whether the cast is there, or if I just let it use DebuggerEvents
        debuggerEvents = (DebuggerEventsClass)_applicationObject.Events.DebuggerEvents;
        debuggerEvents.OnExceptionThrown += new _dispDebuggerEvents_OnExceptionThrownEventHandler(handler);
    }
}

public void handler(string etype, string name, int code, string desc, ref dbgExceptionAction eAction)
{
    Trace.WriteLine("here");
}

永远不会调用方法处理程序。

我已尝试过几种不同的方法来完成上述操作,但似乎没有一种方法可行。有什么我做错了吗?这是VS2010中的错误吗?

编辑:我应该注意,使用这个完全相同的方法适用于其他DebuggerEvent,例如OnEnterBreakMode。

0 个答案:

没有答案