protected virtual void OnExceptionOccurredEvent(DebuggeeExceptionEventArgs e) { if (ExceptionOccurred != null) { ExceptionOccurred(this, e); } }
public void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) { var domain = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain); var thread = domain.GetThread(pThread); var frame = thread.CurrentFrame; string exceptionType = string.Empty; switch (dwEventType) { case CorDebugExceptionCallbackType.CatchHandlerFound: exceptionType = "Catch handler"; break; case CorDebugExceptionCallbackType.FirstChance: exceptionType = "First chance"; break; case CorDebugExceptionCallbackType.Unhandled: exceptionType = "Unhandled"; break; case CorDebugExceptionCallbackType.UserFirstChance: exceptionType = "User first chance"; break; } Log("{0} exception occured in {1}, thread {2}, at offset {3}", exceptionType, domain.Name, thread.Id, nOffset); var eventArgs = new DebuggeeExceptionEventArgs(domain, thread, nOffset, dwEventType); domain.DispatchExceptionOccurredEvent(eventArgs); FinalizeEvent(eventArgs); }
internal void DispatchExceptionOccurredEvent(DebuggeeExceptionEventArgs e) { bool @break = false; switch (e.ExceptionType) { case CorDebugExceptionCallbackType.Unhandled: @break = true; break; case CorDebugExceptionCallbackType.FirstChance: case CorDebugExceptionCallbackType.UserFirstChance: @break = DebuggerBase.Instance.Settings.GetValue <bool>("Exceptions.BreakOnHandledException"); break; case CorDebugExceptionCallbackType.CatchHandlerFound: break; } if (!(e.Continue = !@break)) { OnPaused(e); } OnExceptionOccurredEvent(e); }