internal InternalCatchedExceptionEventArgs( Exception ex, InternalExceptionLocation location) { this.Exception = ex; this.Location = location; }
internal static void PublishInternalExceptionInfo( Exception ex, InternalExceptionLocation location) { List <EventHandler <InternalCatchedExceptionEventArgs> > handlers = null; lock (s_internalExListenersLock) { if (s_internalExListeners.Count > 0) { handlers = new List <EventHandler <InternalCatchedExceptionEventArgs> >( s_internalExListeners); } } foreach (var actEventHandler in handlers) { try { actEventHandler(null, new InternalCatchedExceptionEventArgs( ex, location)); } catch { } } }
public static IDisposable FailTestOnInternalExceptions() { Exception internalEx = null; InternalExceptionLocation location = InternalExceptionLocation.DisposeGraphicsObject; EventHandler <InternalCatchedExceptionEventArgs> eventHandler = (object sender, InternalCatchedExceptionEventArgs e) => { if (internalEx == null) { internalEx = e.Exception; location = e.Location; } }; GraphicsCore.InternalCachedException += eventHandler; return(new DummyDisposable(() => { GraphicsCore.InternalCachedException -= eventHandler; Assert.True(internalEx == null, $"Internal exception at {location}: {internalEx}"); })); }