views:

54

answers:

1

Hello everyone, I see in some applications, when a bug happens, a dialog will appear with error detail, and it also includes a Send button to send this error detail to my logging server. You will see this feature in Firefox web browser.

Please help me to implement this feature in .NET. Thanks.

+3  A: 
 AppDomain.CurrentDomain.UnhandledException += 
    new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException)

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

http://www.switchonthecode.com/tutorials/csharp-tutorial-dealing-with-unhandled-exceptions

sadboy
I agree that this is the best solution. Was about to post this link, but you beat me to the punch: http://richnewman.wordpress.com/2007/04/07/top-level-exception-handling-in-windows-forms-applications-%E2%80%93-code-listing-1/
regex
I wonder the best solution which can help me fix application bugs easiest. That means the solution can log error in detail so that I can find the error reason and fix it. Thanks.
Lu Lu
You could use a logging framework like nlog to print the stacktrace of the exception and write it to disk or send it up to a web servcie.
sadboy