/// <summary> /// Runs only the currently scheduled tasks. /// </summary> public void RunPendingTasks() { foreach (var task in ScheduledTasks.ToArray()) { TryExecuteTask(task); // Propagate exceptions try { task.Wait(); } catch (AggregateException aggregateException) { throw aggregateException.InnerException; } finally { ScheduledTasks.Remove(task); FinishedTasks.Add(task); } } }