Project Description
This is a light weight WPF exception message box that displays information from an exception. It uses reflection to parse exception properties and display the content using a tree view. Inner exceptions can be unfolded and viewed. Exception data can be copied to the clipboard.


ExceptionBox.png

Example usage for typical exceptions:

Catch (Exception e)
{ 
ExceptionMessageBox window = new ExceptionMessageBox(e , "A typical exception has occurred.");
window.ShowDialog();
}


Example usage for unhandled WPF exceptions using the global exception handler:

    public partial class App : Application
    {
        App()
        {
            this.DispatcherUnhandledException += App_DispatcherUnhandledException;
        }

        void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            ExceptionMessageBox window = new ExceptionMessageBox(e.Exception, "AN UNHANDLED EXCEPTION HAS OCCURED.");
            window.ShowDialog();
            Application.Current.Shutdown();
        }
    }


Example usage for WPF background worker exceptions:
 catch (Exception e)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action<Exception>)delegate(Exception e2)
                {
                    ExceptionMessageBox window = new ExceptionMessageBox(e2, "An exception occured in a non UI thread.");
                    window.ShowDialog();
                }, e);
}

Last edited Oct 9, 2010 at 9:42 AM by gsonnenf, version 7