Global Exception Handler WPF

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I am trying to implement a global exception handler, the problem comes when the following line generates an error it just stops in the debugger.

   var list = await _repository.GetAllAsync<ContactView>();

Application.Current.DispatcherUnhandledException +=
            new DispatcherUnhandledExceptionEventHandler(MainThreadExceptionHandler);
AppDomain.CurrentDomain.UnhandledException +=
          new UnhandledExceptionEventHandler(DomainExceptionHandler);

Answers

Try hooking into TaskScheduler.UnobservedTaskException as follows:

TaskScheduler.UnobservedTaskException += ( sender, eventArgs ) =>
{
    ...
};

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/32651830/global-exception-handler-wpf

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils