Beispiel #1
0
            public void ShowAssertDialog(string stackTrace, string message, string detailMessage)
            {
                string fullMessage = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;

                int flags = Interop.User32.MB_OKCANCEL | Interop.User32.MB_ICONHAND | Interop.User32.MB_TOPMOST;

                if (IsRTLResources)
                {
                    flags = flags | Interop.User32.MB_RIGHT | Interop.User32.MB_RTLREADING;
                }

                int rval = 0;

                // Run the message box on its own thread.
                rval = new MessageBoxPopup(fullMessage, SR.DebugAssertTitle, flags).ShowMessageBox();

                switch (rval)
                {
                case Interop.User32.IDCANCEL:
                    if (!System.Diagnostics.Debugger.IsAttached)
                    {
                        System.Diagnostics.Debugger.Launch();
                    }
                    System.Diagnostics.Debugger.Break();
                    break;

                default:
                    Debug.Assert(rval == Interop.User32.IDOK);
                    break;
                }
            }
        private static void ShowMessageBoxAssert(string stackTrace, string message, string detailMessage) {
            string fullMessage = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;

#if !FEATURE_PAL && !FEATURE_CORESYSTEM
            fullMessage = TruncateMessageToFitScreen(fullMessage);
#endif // !FEATURE_PAL && !FEATURE_CORESYSTEM

#if SILVERLIGHT
            int flags = 0x00000001 /*OkCancel*/ | 0x00000010 /*IconHand*/ |
                        0x00040000 /* TopMost */;
#else
            int flags = 0x00000002 /*AbortRetryIgnore*/ | 0x00000200 /*DefaultButton3*/ | 0x00000010 /*IconHand*/ |
                        0x00040000 /* TopMost */;
#endif

#if !SILVERLIGHT    
            if (!Environment.UserInteractive)
                flags = flags | 0x00200000 /*ServiceNotification */;
#endif

            if (IsRTLResources)
                flags = flags | SafeNativeMethods.MB_RIGHT | SafeNativeMethods.MB_RTLREADING;
            int rval = 0;
#if !SILVERLIGHT
            if (!UnsafeNativeMethods.IsPackagedProcess.Value)
            {
                rval = SafeNativeMethods.MessageBox(IntPtr.Zero, fullMessage, SR.GetString(SR.DebugAssertTitle), flags);
            }
            else
            {
#endif
            // Run the message box on its own thread.
            rval = new MessageBoxPopup(fullMessage, SR.GetString(SR.DebugAssertTitle), flags).ShowMessageBox();

#if !SILVERLIGHT
            }
#endif
            switch (rval) {
#if !SILVERLIGHT
                case 3: // abort
                    System.Environment.Exit(1);                    
                    break;
                case 4: // retry
#else
                case 2: // cancel
#endif
                    if (!System.Diagnostics.Debugger.IsAttached) {
                        System.Diagnostics.Debugger.Launch();
                    }
                    System.Diagnostics.Debugger.Break();
                    break;
            }
        }
Beispiel #3
0
        private static void ShowMessageBoxAssert(string stackTrace, string message, string detailMessage)
        {
            string fullMessage = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;

#if !FEATURE_PAL && !FEATURE_CORESYSTEM
            fullMessage = TruncateMessageToFitScreen(fullMessage);
#endif // !FEATURE_PAL && !FEATURE_CORESYSTEM

#if SILVERLIGHT
            int flags = 0x00000001 /*OkCancel*/ | 0x00000010 /*IconHand*/ |
                        0x00040000 /* TopMost */;
#else
            int flags = 0x00000002 /*AbortRetryIgnore*/ | 0x00000200 /*DefaultButton3*/ | 0x00000010 /*IconHand*/ |
                        0x00040000 /* TopMost */;
#endif

#if !SILVERLIGHT
            if (!Environment.UserInteractive)
            {
                flags = flags | 0x00200000 /*ServiceNotification */;
            }
#endif

            if (IsRTLResources)
            {
                flags = flags | SafeNativeMethods.MB_RIGHT | SafeNativeMethods.MB_RTLREADING;
            }
            int rval = 0;
#if !SILVERLIGHT
            if (!UnsafeNativeMethods.IsPackagedProcess.Value)
            {
                rval = SafeNativeMethods.MessageBox(IntPtr.Zero, fullMessage, SR.GetString(SR.DebugAssertTitle), flags);
            }
            else
            {
#endif
            // Run the message box on its own thread.
            rval = new MessageBoxPopup(fullMessage, SR.GetString(SR.DebugAssertTitle), flags).ShowMessageBox();

#if !SILVERLIGHT
        }
#endif
            switch (rval)
            {
#if !SILVERLIGHT
            case 3:     // abort
                System.Environment.Exit(1);
                break;

            case 4:     // retry
#else
            case 2:     // cancel
#endif
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    System.Diagnostics.Debugger.Launch();
                }
                System.Diagnostics.Debugger.Break();
                break;
            }
        }