FAQ :: StartNew() with TaskScheduler.FromCurrentSynchronizationContext() doesn’t work?
We’ve seen a number of folks write the following code to execute on the UI thread and get unexpected behavior. TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();Task uiTask = Task.Factory.StartNew(delegate{ // … Update UI component; BUG!}, uiScheduler);The issue is that the StartNew ca...