/// <summary>
 /// Raise the UnhandledExceptionOccurred event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnUnhandledExceptionOccurred(
     ManagedProcessUnhandledExceptionOccurredEventArgs e)
 {
     if (UnhandledExceptionOccurred != null)
     {
         UnhandledExceptionOccurred(this, e);
     }
 }
Exemplo n.º 2
0
 // Create a minidump if there is a unhandled exception in the target process.
 static void process_UnhandledExceptionOccurred(object sender,
                                                ManagedProcessUnhandledExceptionOccurredEventArgs e)
 {
     Console.WriteLine("Creating Minidump...");
     try
     {
         var dumpFilePath = MiniDump.MiniDumpCreator.CreateMiniDump(e.ProcessID,
                                                                    e.ThreadID, e.ExceptionPointers);
         Console.WriteLine("The minidump file is {0}", dumpFilePath);
         Console.WriteLine("Done...");
     }
     catch (Exception ex)
     {
         Console.WriteLine("Failed to create minidump:");
         Console.WriteLine(ex.Message);
     }
 }