I'll come out of lurker mode
Years ago when I did conference sessions on exception handling I suggested looking at this for ideas: C# Exception Handler. Of course it is not just for C#, and can be applied to any .NET language.
And don't forget to do something about any exceptions that aren't explicitly handled. Put these into your startup code as required:
- AppDomain.UnhandledException= Notification of uncaught exceptions
- Application.ThreadException= Triggered by exceptions that occur in Windows Forms threads; by default doesn’t trigger UnhandledException
- Application.DispatcherUnhandledException= Triggered by exceptions occurring in WPF UI
In XAML
<Application x:Class="ExceptionExampleWPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006 ... esentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DispatcherUnhandledException="MyDispatcherUnhandledExceptionLogger"
StartupUri="Window1.xaml">
</Application>
In code
PROTECTED METHOD OnStartup(e AS StartupEventArgs) AS VOID
// Vulcan
Application.Current:DispatcherUnhandledException += ;
DispatcherUnhandledExceptionEventHandler{SELF,;
@MyDispatcherUnhandledExceptionLogger()}
SUPER:OnStartUp(e)
RETURN
Regards,
Paul