I know that Task Parallel Library is still in Beta and there are likely to be less resources available but from whatever I have read, library gives very special treatment to
There is no built-in support for this like what BackgroundWorker had.
You can use SynchronizationContext directly; there's an excellent video here: http://www.rocksolidknowledge.com/ScreenCasts.mvc/Watch?video=TasksAndThreadAffinity.wmv
The author develops two solutions in this video: one using SynchronizationContext and another using Task Continuations. For your problem, continuations will not work, but the SynchronizationContext approach would work fine.
P.S. If you're creating reusable code, then when you capture SynchronizationContext.Current, you should test for null and (if it is null) use a default-constructed SynchronizationContext instead.
UPDATE: I've posted code for this on my blog. My solution is actually based on a Task
that is scheduled back to the UI thread by a TaskScheduler
which uses SynchronizationContext
underneath. Unlike the accepted answer, this solution will work for both WPF and Windows Forms.