Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

Commented Unassigned: MultiThreading Unhandled Exception not caught in Boostrapper [356]

$
0
0
Overriding the OnUnhandledException doesn't seem to work for exceptions raised from within spawned threads.

I verified this by raising an exception from the UI thread. That is caught as expected. Any workarounds that do not require me to change my application structure?
Comments: The OnUnhandledException function is only called when an exception is raised on the dispatcher, since it hooks the event ```C# Application.DispatcherUnhandledException ``` In case of exceptions raised in tasks, other threads, or generally outside of the dispatcher, OnUnhandledException is not called. It is up to you to handle such exceptions, and act as needed. Mostly, AppDomain and unobserved Task exceptions are enough, so in the Bootstrapper ctor (or static ctor), you can hook these events: ```C# AppDomain.CurrentDomain.UnhandledException += OnCurrentDomainUnhandledException; TaskScheduler.UnobservedTaskException += OnTaskSchedulerUnobservedTaskException; ```

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>