When an unhandled exception occurs a user friendly message goes a long way towards user confidence in your application. The .NET framework provides excellent tools for trapping and handling thread and application exceptions. The trick is to make the exception user friendly and get the user to pass that information back to you for evaluation.
Jeff Atwood, in a contribution on CodeProject, gives a nice template for such a user friendly handler. The IExceptionHandler is largely based on Jeff Atwood's template. There are three classes which implement the interface:
- ConsoleExceptionHandler: displays exception information via the standard output.
- SimpleExceptionHandler: displays exception information via the .NET ThreadExceptionDialog.
- DxExceptionHandler: displays exception information in a user friendly interface. DxExceptionHandler is the full featured solution.
Things to finish:
- Need to write some unit tests.
- Allow the default text values to be changed.