I was under the impression that the dispatcher
will follow the priority
of the operations queued it and execute the operations based on the priority
or the orde
This is because the first MessageBox
is blocking the UI thread.
What Dispatcher.BeginInvoke()
is doing under the hood is taking your delegate and scheduling it to be run on the main UI thread during it's next idle period. However, MessageBox
will block whichever thread it is called from until it is closed. This means that the second MessageBox
cannot be displayed until the first is cleared because the UI thread scheduler sees that the thread is already in use (waiting for the first MessageBox
to be cleared) and can't execute the next delegate containing the second MessageBox
.