Consider the following code:
private static BackgroundWorker bg = new BackgroundWorker();
static void Main(string[] args) {
bg.DoWork += bg_DoWork;
bg.P
BackgroundWorker
raises ProgressChanged
events on the current SynchronizationContext of the thread that called RunWorkerAsync()
.
The default SynchronizationContext runs callbacks on the ThreadPool without any synchronization.
If you use BackgroundWorker in a UI application (WPF or WinForms), it will use that UI platform's SynchronizationContext, which will execute callbacks in order.