To catch an exception, you need to either try try / catch in the Loaded method, or you can tell the dispatcher to notify you of an unhandled exception.
Try the following, for example, in the OnStartup method of your application:
App.Current.DispatcherUnhandledException += (s,e) => {
Edit:
If you want the application to crash, try the following:
App.Current.DispatcherUnhandledException += (s,e) => { // this should cause your application to crash :-) throw new Exception("Now it should crash!", e.Exception); };
The difference is that we create a new exception that is thrown into the user interface.
source share