Ejemplo n.º 1
0
 internal InternalCatchedExceptionEventArgs(
     Exception ex,
     InternalExceptionLocation location)
 {
     this.Exception = ex;
     this.Location  = location;
 }
Ejemplo n.º 2
0
        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 { }
            }
        }
Ejemplo n.º 3
0
        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}");
            }));
        }