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
HideMetroDialogAsync sometimes fails to close dialog #3022
What steps will reproduce this issue?
Attempting to call HideMetroDialogAsync and ShowMetroDialogAsync on two dialogs in rapid succession, with animations on, will sometimes cause HideMetroDialogAsync to never return and thus leave a dialog on the screen perpetually. This is a timing-based bug and can be somewhat difficult to reproduce.
I have done some debugging and have tracked the problem to an issue with WPF's Storyboard class; apparently it does not always fire its Completed event when multiple storyboards are created. Since BaseMetroDialog._WaitForCloseAsync listens to this event, it sometimes fails to complete too.
Note that, while this issue is similar to #2753, the workaround suggested there is not sufficient to solve this problem; both AnimateShow and AnimateHide must be set to to false to avoid it. A possible workaround would be to timeout the _WaitForCloseAsync task if the Completed event takes too long to fire.
Dialogs attempting to open/close at the same time should do so successfully.
This repo (originally submitted as a .zip file in issue #2753 and submitted here with the original author's permission) can somewhat reliably reproduce the bug. The application opens a dialog at the press of a button; when that dialog is closed, a second dialog is very briefly opened and closed too. This will sometimes cause the original dialog to remain open. Repeatedly opening and closing the dialog should eventually trigger the bug.
referenced this issue
Jan 20, 2018
Not sure whether the bug I'm experiencing is this one or #2753 but I'm still having a problem with the MahAppsRace sample on 1.6.5.
Related bug: cloudveiltech/Filter-Windows#183
This is a very intermittent bug. It might exhibit itself 2-3 times out of 100. This also happens on ShowMetroDialogAsync, but it's more noticeable with HideMetroDialogAsync.