GSF.Diagnostics.Logger.CurrentDomain_FirstChanceException C# (CSharp) Method

CurrentDomain_FirstChanceException() private static method

private static CurrentDomain_FirstChanceException ( object sender, System e ) : void
sender object
e System
return void
        private static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
        {
            if ((Thread.CurrentThread.ThreadState & (ThreadState.AbortRequested | ThreadState.Aborted)) != 0)
            {
                return;
            }
            if (ShouldSuppressFirstChanceLogMessages)
                return;
            using (SuppressFirstChanceExceptionLogMessages())
            {
                try
                {
                    var perm = new ReflectionPermission(PermissionState.Unrestricted);
                    perm.Demand();
                }
                catch (SecurityException)
                {
                    //Cannot raise messages if this permission is denied.
                    return;
                }

                try
                {
                    EventFirstChanceException.Publish(null, null, e.Exception);
                }
                catch (Exception)
                {
                    //swallow any exceptions.
                }
                ThreadLocalThreadStack.Value.PreviousFirstChanceExceptionSequenceNumber++;
            }
        }