/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnUnhandledExceptionFilter(object sender, DispatcherUnhandledExceptionFilterEventArgs e) { e.RequestCatch = true; var ex = e.Exception; Logging.Log(Logger, new LogItem("", ex, LogLevel.Error)); }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DispatcherOnUnhandledExceptionFilter(object sender, DispatcherUnhandledExceptionFilterEventArgs e) { e.RequestCatch = true; MessageBox.Show(e.Exception.Message); }
private Dispatcher() { _queue = new PriorityQueue<DispatcherOperation>(); _tlsDispatcher = this; // use TLS for ownership only _dispatcherThread = Thread.CurrentThread; // Add ourselves to the map of dispatchers to threads. lock(_globalLock) { _dispatchers.Add(new WeakReference(this)); } _unhandledExceptionEventArgs = new DispatcherUnhandledExceptionEventArgs(this); _exceptionFilterEventArgs = new DispatcherUnhandledExceptionFilterEventArgs(this); _dispatcherSynchronizationContext = new DispatcherSynchronizationContext(this); // Create the message-only window we use to receive messages // that tell us to process the queue. MessageOnlyHwndWrapper window = new MessageOnlyHwndWrapper(); _window = new SecurityCriticalData<MessageOnlyHwndWrapper>( window ); _hook = new HwndWrapperHook(WndProcHook); _window.Value.AddHook(_hook); }