Scott Olson Scott Olson - 1 year ago 210
C# Question

WPF global exception handler

Sometimes, under not reproducible circumstances, my WPF application crashes without any message. The application simply close instantly.

Where is the best place to implement the global Try/Catch block. At least I have to implement a messagebox with: "Sorry for the inconvenience ..."

Answer Source

You can handle the AppDomain.UnhandledException event

EDIT: actually, this event is probably more adequate: Application.DispatcherUnhandledException

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download