2

I am trying to develop an addin for VS2010 that catches the DebuggerEvents.OnExceptionThrown event, but for some reason it never gets handled. Here is some simple code that does not work:

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");
}

The method handler never gets called.

I have tried several different methods of doing the above, but none of them seem to work. Is there something that I am doing wrong? Is this a bug in VS2010?

EDIT: I should note that using this exact same method works for other DebuggerEvents such as OnEnterBreakMode.

0 Answers0