Caliburn.Micro
Caliburn.Micro copied to clipboard
Error in Task that is wrapped as IResult just quietly dies on exception
Thansk to this code in TaskResult class the Coroutine just queitly dies when exception occours in Task.
protected virtual void OnCompleted(Task task)
{
Completed(this, new ResultCompletionEventArgs { WasCancelled = task.IsCanceled, Error = task.Exception });
}
OnUnhandledException in bootstrapper isnt called either
A workaround to catch unhandled exceptions is to use the Coroutine.Completed event.
public abstract class TypedBootstrapper : BootstrapperBase
{
protected override void Configure()
{
Coroutine.Completed += CoroutineOnCompleted;
}
private static void CoroutineOnCompleted(object sender, ResultCompletionEventArgs e)
{
if (e.Error != null)
{
// Do something with the unhandled exception
}
}
}