I have a task with a continuation to handle errors:
var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
var loadTask = Task<List<OrderItemViewModel>>.Factory.StartNew(() =>
{
throw new Exception("derp");
});
var errorContinue = loadTask.ContinueWith(t =>
{
MainViewModel.RemoveViewModel(this);
}, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, uiScheduler);
The continuation is hit, but a few seconds later I receive this error in the application:
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
Is this related to the uiScheduler? The solution to the similar question is basically what I'm doing A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was