コード例 #1
0
        /// <summary>
        /// Equivalent to "System.Environment.FailFast(string, System.Exception)" that also does custom Watson reports.
        /// This method suppresses all the exceptions as this is not important for any
        /// functionality. This feature is primarily used to help Microsoft fix
        /// bugs/crashes from customer data.
        /// </summary>
        /// <param name="exception">
        /// exception causing the failure. It is good to make sure this is not null.
        /// However the code will handle null cases.
        /// </param>
        internal static void FailFast(Exception exception)
        {
            Dbg.Assert(false, "We shouldn't do to FailFast during normal operation");

            try
            {
                if (s_registered && (null != exception))
                {
                    Debug.Assert(IsWindowsErrorReportingAvailable(), "Registration should succeed only if WER.dll is available");
                    WindowsErrorReporting.SubmitReport(exception);
                }
            }
            catch (Exception)
            {
                // SubmitReport can throw exceptions. suppressing those as they are not
                // important to report back.
                // Not calling CommandProcessorBase.CheckForSevereException(e) as it
                // would introduce a recursion.
            }
            finally
            {
                // FailFast if something went wrong and SubmitReport didn't terminate the process
                // (or simply if not registered)
                Environment.FailFast((null != exception) ? exception.Message : string.Empty);
            }
        }
コード例 #2
0
 private static void CurrentDomain_UnhandledException(
     object sender,
     UnhandledExceptionEventArgs e)
 {
     if (!(e.ExceptionObject is Exception exceptionObject))
     {
         return;
     }
     WindowsErrorReporting.SubmitReport(exceptionObject);
 }
コード例 #3
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Dbg.Assert(false, "We shouldn't get unhandled exceptions during normal operation: " + e.ExceptionObject.ToString());

            Exception exception = e.ExceptionObject as Exception;

            if (exception != null)
            {
                WindowsErrorReporting.SubmitReport(exception);
            }
        }
コード例 #4
0
 internal static void FailFast(Exception exception)
 {
     if (exception == null)
     {
         throw new ArgumentNullException(nameof(exception));
     }
     try
     {
         if (!WindowsErrorReporting.registered)
         {
             return;
         }
         WindowsErrorReporting.SubmitReport(exception);
     }
     finally
     {
         Environment.FailFast(exception.Message);
     }
 }