사용자가 응용 프로그램을 디버깅하고 처리되지 않은 예외가 발생하는 경우를 처리해야하는 Visual Studio 용 AddIn을 만들었습니다. 응용 프로그램 개체의 "이벤트"속성을 사용하여 "OnExeceptionNotHandled"및 "OnExceptionThrown"이벤트를 등록했습니다. 문서에서 "OnEnterBreakMode"전에 이러한 이벤트가 시작된다는 것을 읽을 수 있습니다. 하지만 "ArgumentException"을 throw하는 간단한 응용 프로그램을 디버깅 할 때 이벤트가 발생하지 않습니다. 내 코드는 다음과 같습니다 (축약 됨) :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;
}
나는 정확히 같은 문제에 봉착를, 나는 이벤트 중 하나 화재에 도착하지 못할 :( –