I want my application not to close after an unhandled exception has been processed.
I do this with Xamarin and MonoMac, but I think I could translate Objective-C answers into C #.
When an exception occurs and it is not caught anywhere, I log an event of unhandled exceptions:
AppDomain.CurrentDomain.UnhandledException += HandleUnhandledException;
And write it down:
static void HandleUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
But then, when an exception occurs, a HandleUnhandledException is thrown and the event loop ends:
NSApplication.Main(args);
So my application is ending. How can i avoid this? Where should I place the try-catch block?
source
share