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 (3)

  1. Erno says:

    Karsten,

    Please let me/us know what you think of my suggestion:

    http://blogs.infosupport.com/ernow/archive/2006/05/17/6280.aspx

    Thanks

  2. Currently, I am struggling with WinFX and I must admit that I do not like the way how WPF (Windows Presentation…

Skip to main content