when application raises some exception, normally what is done is, exception is logged, displayed to user, and based on its severity, we continue to use app or close it.
In case of some exceptions, like
"Cannot perform this operation while dispatcher processing is suspended."
exception, where UI cannot display message to user, we need to use Dispatcher.BeginInvoke to asynchronously show the message to user. The problem with BeginInvoke is that it returns immediately and code continues to execute where from the point it showed message box. In cases where we require user input (like Yes / No dialogs).
So, how can we safely show the message box dialog, and still wait for the user resulting action, before we continue with code execution?