题
在我的C#应用程序,甚至是我处理的例外:
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
然后在处理程序表示对话框并做应用程序。退出 仍然得到windows错误报告的对话与发送,不送...
如何防止windows错误报告的对话,从出现了?
事实上,如果唯一的例外是扔从主要形式构造,然后该程序结束了Windows错误报告dlg.否则,如果从其他一些位置的线,然后作为预期。
解决方案
你只需要终止该程序自己。这将会这样做:
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
var ex = e.ExceptionObject as Exception;
MessageBox.Show(ex.ToString());
if (!System.Diagnostics.Debugger.IsAttached)
Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
}
其他提示
该对话提出的选择发送或不发送错误的报告,以Microsoft超出了例外情况。这可能发生如果您使用的不安全{}块或使用p/援引的其执行某些非法操作。
我认为你不应战斗的症状你的问题。未经处理的例外情况不应该发生在第一位。
你有任何的线索是什么导致他们吗?
不隶属于 StackOverflow