I have the following code in my application that is running after an unhandled exception:
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = e.ExceptionObject as Exception;
if (exception != null) MessageBox.Show(exception.Message + " - " + exception.StackTrace);
}
but even if i catch unhandled exception my windows mobile application close. How to prevent closing application when i catch unhandled exception. I never want to close my app. I want to open Login form in this scenario or anything else not close app.
So what i want is to prevent closing application from unhandled exception like network is down,...
I can not use try catch in every code ....
Any idea how to prevent closing app when network is down or any other unhandled exceptions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…