May 9, 2014 at 1:05 PM
Edited May 12, 2014 at 7:51 AM
I'm trying to take care of unhandled exceptions with async/await on a wpf project. The main purpose is to keep track of the exceptions as it seems that caliburn is swallowing those exceptions in async methods (same as
So far, I found this
who uses SynchronizationContext but it's based on a Win8 application.
So I tried to "register" my SynchronizationContext in my App.xaml.cs but the SynchronizationContext.current is always null :
public partial class App : Application
public class AsyncSynchronizationContext : SynchronizationContext
public static AsyncSynchronizationContext Register()
var syncContext = Current;
if (syncContext == null)
throw new InvalidOperationException("Ensure a synchronization context exists before calling this method.");
var customSynchronizationContext = syncContext as AsyncSynchronizationContext;
if (customSynchronizationContext == null)
customSynchronizationContext = new AsyncSynchronizationContext(syncContext);
Should I register somewhere else in the Bootstrapper ?
Maybe there's other way to manage those exceptions with async/await.