none
Suppressing Error reportingfor an application RRS feed

  • Question

  • Hi All,

    Is there a way to suppress the Microsoft Error Report dialog for a particular application? I want to do this through code.

    Also is there a way to not have the application crashed after an unhandledExceptionEvent occurs?

    Thanks

    Zepher


    Zepher684
    Monday, May 3, 2010 10:15 AM

Answers

  • No, you do not need to put try catch block for each thread. I will suggest use Application.ThreadException event instead.

     

    You will be required to register Application.ThreadException event in Main() method of application. This event will catch all the entrapped exceptions of the threads created by application.

     

    Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

     

    Check this link for more information http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx 

     

    Hope this will help...

     


    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. My Blog: http://ashishkhandelwal.arkutil.com
    • Proposed as answer by Ashish Khandelwal Wednesday, May 12, 2010 11:40 AM
    • Marked as answer by SamAgain Thursday, May 13, 2010 12:44 AM
    Wednesday, May 12, 2010 11:40 AM
  • Unless you are hosting(CLR) applications you cannot catch all the exceptions and continue to have the process running. This could cause serious issues in the state of the application. This is by design.

    Here is how you can configure it not to send the Watson dumps using

     

    http://blogs.msdn.com/clrteam/archive/2009/10/15/automatically-capturing-a-dump-when-a-process-crashes.aspx

    If is for a specific process then the OS should be Vista+

    The Clr team has shown how to configure getting a crashdump for a particular process. The same setting can be used to do what ever you want when the process crashes.

     

    HTH


    Thanks Naveen http://naveensrinivasan.com
    • Proposed as answer by NaveenS Wednesday, May 12, 2010 6:08 PM
    • Marked as answer by SamAgain Thursday, May 13, 2010 12:44 AM
    Wednesday, May 12, 2010 6:08 PM

All replies

  • Hi zepher684,

        Please take a look at the following references.

        1. A Simple Class to Catch Unhandled Exceptions in WinForms

        2. Suppress unhandled exception dialog?

        


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Marked as answer by SamAgain Tuesday, May 11, 2010 9:41 AM
    • Unmarked as answer by Zepher684 Tuesday, May 11, 2010 10:03 AM
    Tuesday, May 11, 2010 9:39 AM
  • Hi Sam,

    Thanks for your suggestions but unfortunately both of them do not help me.

    Appraoch1: Use of UnhandeldExceptionEvent handler does not prevent the application from poppin up the Microsoft error reporting dailogbox. Though it allows you the do your processing before showing the dialog.

    Apppraoch2: I cannot actually expect the customer to allow disabling error reporting just because my application cannot handle exceptions gracefully. Also adding exception to the error reporting does not help as it only takes away the option of sending the report to the microsoft.

     

    What I am looking for is a global handler in my application that catches all unhandled exception but does not show the microsoft error report dialog. Do let me know if i am missing a point here.

     

    Thanks

    Zepher


    Zepher684
    Tuesday, May 11, 2010 10:03 AM
  • Just add a try catch block in the main method of the application, and leave the catch block blank.
    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. My Blog: http://ashishkhandelwal.arkutil.com
    • Proposed as answer by Ashish Khandelwal Wednesday, May 12, 2010 5:38 AM
    • Unproposed as answer by Zepher684 Wednesday, May 12, 2010 5:58 AM
    Tuesday, May 11, 2010 10:59 AM
  • Hi Ashish,

    Thanks for your inputs. But this apporach will not work for me as i am working with a multithreaded application. The catch block will not help with threads spawned from the thread on which we have this try..catch block.

    But yes i am working in the direction of putting a try catch block for each thread that i spawn, though a bit awkward this is the only solution that comes to anywhere close to solving my issue.

    Thanks

    Zepher


    Zepher684
    • Edited by Zepher684 Wednesday, May 12, 2010 6:03 AM Addded more info
    Wednesday, May 12, 2010 6:00 AM
  • No, you do not need to put try catch block for each thread. I will suggest use Application.ThreadException event instead.

     

    You will be required to register Application.ThreadException event in Main() method of application. This event will catch all the entrapped exceptions of the threads created by application.

     

    Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

     

    Check this link for more information http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx 

     

    Hope this will help...

     


    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. My Blog: http://ashishkhandelwal.arkutil.com
    • Proposed as answer by Ashish Khandelwal Wednesday, May 12, 2010 11:40 AM
    • Marked as answer by SamAgain Thursday, May 13, 2010 12:44 AM
    Wednesday, May 12, 2010 11:40 AM
  • Unless you are hosting(CLR) applications you cannot catch all the exceptions and continue to have the process running. This could cause serious issues in the state of the application. This is by design.

    Here is how you can configure it not to send the Watson dumps using

     

    http://blogs.msdn.com/clrteam/archive/2009/10/15/automatically-capturing-a-dump-when-a-process-crashes.aspx

    If is for a specific process then the OS should be Vista+

    The Clr team has shown how to configure getting a crashdump for a particular process. The same setting can be used to do what ever you want when the process crashes.

     

    HTH


    Thanks Naveen http://naveensrinivasan.com
    • Proposed as answer by NaveenS Wednesday, May 12, 2010 6:08 PM
    • Marked as answer by SamAgain Thursday, May 13, 2010 12:44 AM
    Wednesday, May 12, 2010 6:08 PM
  • We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Please mark the right answer at right time.
    Thanks,
    Sam
    Thursday, May 13, 2010 12:44 AM