Je m'inscris à l'exception non gérée de mon application WPF.enregistrement UnhandledException de AppDomain WPF
Après que UnhandledExceptionHandler invoque, l'application se ferme automatiquement? Ou dois-je appeler ShutdownProcess();
Est-ce suffisant?
static void Main(string[] args)
{
//Register to unhandled exception for this application
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{
try
{
Exception ex = (Exception)args.ExceptionObject;
_logger.ErrorFormat("Process caught unhandled exception, Exception = {0}", ex);
ShutdownProcess();
}
catch
{
// swallow silently... nothing we can do.
}
}
L'application se fermera automatiquement si vous ne définissez pas e.Handled = true. Quelle était votre question exactement? –
Je n'ai aucun e.Handled et ce n'est pas DispacherUnhandledException .. – ilansch
Ma question est - est-ce que mon processus sera fermé automatiquement? va-t-il afficher une fenêtre popup OS "laide" à propos de l'écrasement? – ilansch