J'ai créé un AddIn pour Visual Studio, qui doit gérer le cas lorsque l'utilisateur débogue une application et qu'une exception non gérée est levée. J'ai enregistré les événements "OnExeceptionNotHandled" et "OnExceptionThrown" en utilisant la propriété "Events" de l'objet d'application. Dans la documentation on peut lire que ces événements se déclenchent avant le "OnEnterBreakMode". Mais quand je débogue une application simple qui lance une "ArgumentException" les événements ne sont pas déclenchés. Voici mon code (raccourci):Gestion des événements du débogueur de Visual Studio 2008
public class Connect : IDTExtensibility2
{
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
_debuggerEvents = _applicationObject.Events.DebuggerEvents;
_debuggerEvents.OnExceptionThrown += new _dispDebuggerEvents_OnExceptionThrownEventHandler(_debuggerEvents_OnExceptionThrown);
_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(_debuggerEvents_OnExceptionNotHandled);
}
void _debuggerEvents_OnExceptionNotHandled(string ExceptionType, string Name, int Code, string Description, ref dbgExceptionAction ExceptionAction)
{
m_panOutput.OutputString("NotHandled\n");
}
void _debuggerEvents_OnExceptionThrown(string ExceptionType, string Name, int Code, string Description, ref dbgExceptionAction ExceptionAction)
{
m_panOutput.OutputString("Thrown\n");
}
void _debuggerEvents_OnEnterBreakMode(dbgEventReason Reason, ref dbgExecutionAction ExecutionAction)
{
m_panOutput.OutputString("EnterBreakMode\n");
}
DebuggerEvents _debuggerEvents;
}
Je vais avoir exactement le même problème, je ne peux pas obtenir les événements à l'incendie soit :( –