private static void ShowMessageBoxAssert(string stackTrace, string message, string detailMessage) {
string fullMessage = message + "\r\n" + detailMessage + "\r\n" + stackTrace;
int flags = 0x00000002 /*AbortRetryIgnore*/ | 0x00000200 /*DefaultButton3*/ | 0x00000010 /*IconHand*/ |
0x00040000 /* TopMost */;
if (IsRTLResources)
flags = flags | SafeNativeMethods.MB_RIGHT | SafeNativeMethods.MB_RTLREADING;
int rval = SafeNativeMethods.MessageBox(NativeMethods.NullHandleRef, fullMessage, SR.GetString(SR.DebugAssertTitle), flags);
switch (rval) {
case 3: // abort
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
try {
Environment.Exit(1);
}
finally {
CodeAccessPermission.RevertAssert();
}
break;
case 4: // retry
if (!System.Diagnostics.Debugger.IsAttached) {
System.Diagnostics.Debugger.Launch();
}
System.Diagnostics.Debugger.Break();
break;
}
}