I am still learning the whole Task-concept and TPL. From my current understanding, the SynchronizationContext functions (if present) are used by await
to dispat
How can I obtain a Task, that actually runs an action but is dispatched using SynchronizationContext.Current.Send/Post?
Use special task scheduler:
Task.Factory.StartNew(
() => {}, // this will use current synchronization context
CancellationToken.None,
TaskCreationOptions.None,
TaskScheduler.FromCurrentSynchronizationContext());
And can anyone recommend a good introduction into SynchronizationContext
Look at the article It's All About the SynchronizationContext by Stephen Cleary.