示例#1
0
 private static void ShowDialog(string stackTrace, string message, string detailMessage, string errorSource)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
     else
     {
         // In Core, we do not show a dialog.
         // Fail in order to avoid anyone catching an exception and masking
         // an assert failure.
         DebugAssertException ex;
         if (message == String.Empty)
         {
             ex = new DebugAssertException(stackTrace);
         }
         else if (detailMessage == String.Empty)
         {
             ex = new DebugAssertException(message, stackTrace);
         }
         else
         {
             ex = new DebugAssertException(message, detailMessage, stackTrace);
         }
         Environment.FailFast(ex.Message, ex, errorSource);
     }
 }
        public static void FailCore(string stackTrace, string?message, string?detailMessage, string errorSource)
        {
            if (s_FailCore != null)
            {
                s_FailCore(stackTrace, message, detailMessage, errorSource);
                return;
            }

            if (Debugger.IsAttached)
            {
                Debugger.Break();
            }
            else
            {
                // In Core, we do not show a dialog.
                // Fail in order to avoid anyone catching an exception and masking
                // an assert failure.
                DebugAssertException ex;
                if (message == string.Empty)
                {
                    ex = new DebugAssertException(stackTrace);
                }
                else if (detailMessage == string.Empty)
                {
                    ex = new DebugAssertException(message, stackTrace);
                }
                else
                {
                    ex = new DebugAssertException(message, detailMessage, stackTrace);
                }
                Environment.FailFast(ex.Message, ex, errorSource);
            }
        }
示例#3
0
 public void ShowAssertDialog(string stackTrace, string message, string detailMessage)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
     else
     {
         // TODO: #3708 Determine if/how to put up a dialog instead.
         var exc = new DebugAssertException(message, detailMessage, stackTrace);
         if (!s_shouldWriteToStdErr) 
         {
             // We always want to print out Debug.Assert failures to stderr, even if
             // !s_shouldWriteToStdErr, so if it wouldn't have been printed in
             // WriteCore (only when s_shouldWriteToStdErr), print it here.
             WriteToStderr(exc.Message);
         }
         throw exc;
     }
 }
示例#4
0
 public void ShowAssertDialog(string stackTrace, string message, string detailMessage)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
     else
     {
         // TODO: #3708 Determine if/how to put up a dialog instead.
         var exc = new DebugAssertException(message, detailMessage, stackTrace);
         if (!s_shouldWriteToStdErr)
         {
             // We always want to print out Debug.Assert failures to stderr, even if
             // !s_shouldWriteToStdErr, so if it wouldn't have been printed in
             // WriteCore (only when s_shouldWriteToStdErr), print it here.
             WriteToStderr(exc.Message);
         }
         throw exc;
     }
 }