c# - How to catch all Exceptions in a WPF program so that TextWriterTraceListener writes it to the log before crashing -
i have pretty normal wpf program (in vb.net same should no different c#) , have implemented textwritertracelistener writes log file. issue have if there exception uncaught app crashes , log file seems "behind" not show last entry before crashing.
can somehow make textwritertracelistener write log file faster?
i have implemented application_dispatcherunhandledexception not seem catch unhandled errors.
i aware on proper close down have call flush , close on textwritertracelistener object, issue if app crashes don't opportunity this.
have tried add
appdomain.currentdomain.unhandledexception += appdomain_unhandledexception;
as application_dispatcherunhandledexception
?
Comments
Post a Comment