Because internally Progress
stores a reference to what was in SynchronizationContext.Current
when it was constructed, and it fires the event to that context when reporting progress.
It was specifically designed for updating the UI from a non-UI thread. If it didn't do this, there wouldn't be nearly as much reason to use it, nor is it hard at all to do.
Here is what I use as an implementation of Progress
pre .NET 4.5. It won't be identical to the .NET implementation, but it'll give you a pretty good idea of what's going on:
public interface IProgress<T>
{
void Report(T data);
}
public class Progress<T> : IProgress<T>
{
SynchronizationContext context;
public Progress()
{
context = SynchronizationContext.Current
?? new SynchronizationContext();
}
public Progress(Action<T> action)
: this()
{
ProgressReported += action;
}
public event Action<T> ProgressReported;
void IProgress<T>.Report(T data)
{
var action = ProgressReported;
if (action != null)
{
context.Post(arg => action((T)arg), data);
}
}
}