New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HideMetroDialogAsync sometimes fails to close dialog #3022

Closed
AndreaZChen opened this Issue Aug 17, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@AndreaZChen

AndreaZChen commented Aug 17, 2017

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.

Expected outcome

Dialogs attempting to open/close at the same time should do so successfully.

Repo

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.

https://github.com/AndreasZChen/MahAppsRace

Environment

  • MahApps.Metro v1.5.0
  • Windows OS 10
  • Visual Studio 2017
  • .NET Framework 4.7

@punker76 punker76 self-assigned this Jan 20, 2018

@punker76 punker76 added the Bug label Jan 20, 2018

@punker76 punker76 added this to the 1.6.0 milestone Jan 20, 2018

@kfreezen

This comment has been minimized.

kfreezen commented Nov 29, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment