c# - How to crash on unhandled Exception -
i have created custom exceptions in wpf project , pretty sure not catching them, when thrown, application not crash either. exception logged in output window though.
my custom exceptions derive system.exception , have checked try{}catch{} statements if catch custom exception or system.exception. none of them that. using visual studio 2010 , running on 32bit machine, this seems different problem.
you can add handler appdomain.unhandledexception event:
appdomain.currentdomain.unhandledexception += app_unhandledexception; public void app_unhandledexception(object sender, unhandledexceptioneventargs e) { exception exception = (exception)e.exceptionobject; error error = new error(exception, mainviewmodel.statemanager.currentuser); mainviewmodel.adderror(error); } error custom class use log errors in database with. if put break point in method, execution jump here whenever there uncaught exception objects have been thrown.
Comments
Post a Comment