Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Race condition in ShowMetroDialogAsync/HideMetroDialogAsync #2753
What steps will reproduce this issue?
We have a MetroDialog that when closed triggers an asynchronous operation that causes another MetroDialog to briefly get shown and then removed again.
Depending on timing in ShowMetroDialogAsync and HideMetroDialogAsync, sometimes the original dialog is never removed from screen and that call to HideMetroDialogAsync never completes.
We have tracked down the problem to BaseMetroDialog._WaitForCloseAsync(), where the closingStoryboard.Completed event is never triggered, so the task never completes.
A workaround is to set DialogSettings.AnimateHide=false on the dialog (a related issue seems to be #2735).
Here is a very small project that on my computer easily repeats the problem.
You open a CustomDialog with the button in the title bar, and when you close the dialog another CustomDialog is shown a (ridicilously) short time while the first dialog is closing. Almost every time this causes the HideMetroDialogAsync of the first dialog to never complete and the dialog to remain visible.