Share via


Catching XAML Exceptions

If you have worked with XAML, you may have noticed that the exception handling is, well, non-existent.  This is painful during the experience of building your application, although as I mentioned in a previous post, EID has some nice support for helping you understand why your XAML is unhappy at design-time.

The question that has been raised by a few folks is how to catch XAML exceptions at runtime in your application. There are two events you can listen for:

Application.Current.DispatcherUnhandledException

AppDomain.CurrentDomain.UnhandledException

Both of these can be wired up so that you can swallow any ugliness that you might not get in your own try/catch blocks.

Comments