How do I suppress the Microsoft Error Report dialog when a child process crashes
I'm creating a process with the System.Diagnostics.Process
object that sometimes crashes badly and Windows puts up the Send Error Report dialog. I have no control over the child process, but I'm already handling the case when it crashes, how do I prevent the dialog from poping up?
Process p = new Process();
p.StartInfo.FileName = Path.Combine(avokeHome, @"bin\folderstx.exe");
p.StartInfo.Arguments = "-f" + propertiesFile;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutpu开发者_如何学编程t = true;
p.OutputDataReceived += (sender, e) => { if(!string.IsNullOrEmpty(e.Data)) Console.WriteLine(e.Data); };
p.ErrorDataReceived += (sender, e) => { if(!string.IsNullOrEmpty(e.Data)) Console.WriteLine(e.Data); };
p.EnableRaisingEvents = true;
p.Exited += (sender, e) => { Console.WriteLine("Exited"); };
p.Start();
p.BeginErrorReadLine();
p.BeginOutputReadLine();
I think its little difficult to achieve that. Reporting an error is user's choice (We set it via Control Panel -> Action Centre -> Problem Reporting Settings (Win 7))
Also. Check out this article from MS Support which talks about disabling this reporting (for all apps) with some registry entries.
精彩评论