This project is read-only.


Even I'm not perfect. Well OK, let me restate that. Computers are not perfect so when running perfect code on them, they will at times misbehave, causing your application to complain. So in order to capture as much incriminating evidence as I can, I've added a couple of last-resort hooks within App.xaml.cs to catch, report, and record any unhandled exceptions.

Of course a WPF application is multi-threaded and the App class is typically just a bootstrap without very much business logic. In order to catch unhandled exception, we need to register a couple of event handlers:

this.DispatcherUnhandledException +=
    new DispatcherUnhandledExceptionEventHandler(CatchUnhandledUIExceptions);

AppDomain.CurrentDomain.UnhandledException +=
    new UnhandledExceptionEventHandler(CatchUnhandledBackgroundExceptions);
From these two handlers, CatchUnhandledUIExceptions and CatchUnhandledBackgroundExceptions, we convert the Exception into a SmartException. A SmartException is merely a wrapper that provides some pretty formatting (XML) for display in a dialog or to record in a log file.

Whenever one of these unhandled exceptions is caught in the App class, iTuner displays it in a dialog so you can immediately enjoy the happy news. The exception is also record it in a log file in the same directory as the iTuner.exe application.

Please Report Issues

I'm happy to answer questions and certainly want to resolve any valid issues. Please report these unhandled exceptions in the Issue Tracker and attach the log file so I can debug and fix as soon as possible. Cheers!

Copyright (c) 2010 Steven M. Cohn. All rights reserved.

Last edited Mar 24, 2010 at 10:19 PM by stevenmcohn, version 6


No comments yet.