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.

  1. can somehow make textwritertracelistener write log file faster?

  2. 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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -