Reputation: 865
I followed the example below for global exception trapping in WPF. In the example he throws a null pointer exception in a try-catch block and then another outside the block. The second is supposed to be handled in the app.xaml.cs file in the Application_DispatcherUnhandledException() procedure. This procedure is subscribed to in the app.xaml file with DispatcherUnhandledException="Application_DispatcherUnhandledException".
For me it does not work. Any ideas why? I am in VS 2010 and I think this tutorial is for VS 2012. Perhaps the behavior changed between versions.
http://www.wpf-tutorial.com/wpf-application/handling-exceptions/
Greg
Upvotes: 0
Views: 77
Reputation: 1753
The version of visual studio wouldnt affect this sort of behaviour.
I tried the example you linked to and it worked as expected for me.
Are you running it in Debug? If so Visual Studio will catch the unhandled exception before your handler would do (depending on how you have exceptions set up). Try running it using 'Start without debugging' and see if you hit the secind Message Box.
Upvotes: 1