locked
ReportFault not working RRS feed

  • Question

  • To support XP/2003, I need to use ReportFault in lieu of WER. Anyway, ReportFault doesn't seem to work at all in my test app (C#). So, I tried a native C++ test app (from this site: http://www.clausbrod.de/cgi-bin/view.pl/Blog/DefinePrivatePublic200706), and that didn't work either! I'm guessing that there's a setting that globally enables crash reporting. So, I searched for and found that setting, and it's enabled for all programs (MS or otherwise). (I found that setting by right-clicking My Computer, going to Advanced, then clicking on Error Reporting button.)

     

    Anyone know what the heck is going on here? I know I've seen the "send to microsoft" screen before. Any direction on this would be appreciated.

     

    Oh, if you want to see the C# sample code I'm using, here it is. ReportFault seems to return either a 0 or a 2, depending on the system I run it on.

     

    Code Snippet

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Runtime.InteropServices;

     

    namespace WERtest1

    {

    class Program

    {

    static void Main(string[] args)

    {

    new WERtest1();

    }

    }

    internal class WERtest1

    {

    [DllImport("faultrep.dll", CharSet = CharSet.Unicode)]

    public static extern int ReportFault(Exception ex,int mode);

    public WERtest1()

    {

    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

    DoCrash();

    }

    void DoCrash()

    {

    throw new Exception("wha?");

    }

    void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)

    {

    int ret = ReportFault(e.ExceptionObject as Exception, 0);

    Console.WriteLine("Return value: {0}", ret);

    }

    }

    }

     

     

    • Moved by Max Wang_1983 Tuesday, April 26, 2011 5:06 PM forum consolidation (From:Windows Error Reporting for ISVs)
    Monday, June 23, 2008 2:21 PM

Answers

  • Please make sure that your settings are like this for the machine where you are not seeing error reporting dialog.

     

    Software\Microsoft\PCHealth\ErrorReporting

     

    ShowUI = 1 (DWORD)

    DoReport = 1 (DWORD)

    ForceQueueMode = 0 (DWORD) – setting this to 1 will force crashes to queue up.

    Monday, July 14, 2008 1:20 AM

All replies

  • On XP and later, error reporting is enabled by default and applications get error reporting support for free without having to call any API.

     

    CLR 2.0 and later also have full support for error reporting.

    Monday, June 23, 2008 11:49 PM
  • No need to use API?

     

    Indeed! I removed the call to ReportFault and the code brought up the "send to MS" box when I ran it on Svr2003. Very interesting... so why would anyone explicitly call ReportFault (or use the WER API), since the "send to MS" box will come up regardless?

     

    Still having issues

     

    Unfortunately, the situation is still this:

     

    Svr2003             ---            XP Pro

    -------------------------------------------------------------

    test app works                  test app does not

    (brings up "send to MS"     bring up "send to MS"

    on crash)                          message upon crashing

     

    I remember disabling error reporting a long time ago... however, I have since re-enabled error reporting on my XP box (and yes, I restarted my machine after I did that). And yet, no "send to MS" prompts come up when I run my test apps.

     

    I'll bet every other XP machine on the planet brings up the "send to MS" prompt when I run these test apps. But not my own. Any guesses as to what's going on?

     

    Thanks for all the help thus far.

    Tuesday, June 24, 2008 12:55 PM
  • Please make sure that your settings are like this for the machine where you are not seeing error reporting dialog.

     

    Software\Microsoft\PCHealth\ErrorReporting

     

    ShowUI = 1 (DWORD)

    DoReport = 1 (DWORD)

    ForceQueueMode = 0 (DWORD) – setting this to 1 will force crashes to queue up.

    Monday, July 14, 2008 1:20 AM