Skip to content
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

ShowMessageAsync throws when cancelled #3214

Closed
ian-g-holm-intel opened this issue Apr 3, 2018 · 1 comment · Fixed by #3993
Closed

ShowMessageAsync throws when cancelled #3214

ian-g-holm-intel opened this issue Apr 3, 2018 · 1 comment · Fixed by #3993
Assignees
Labels
Milestone

Comments

@ian-g-holm-intel
Copy link

ian-g-holm-intel commented Apr 3, 2018

Description

I am unable to cancel a dialog created using DialogCoordinator.Instance.ShowMessageAsync() without getting an exception with the message "The calling thread cannot access this object because a different thread owns it." I've tried with and without using Dispatcher.Invoke.

What steps will reproduce this issue?

  1. Create an instance of MetroDialogSettings with CancellationToken assigned
  2. Call ShowMessageAsync using the DialogCoordinator and passing in the dialog settings
  3. Cancel the token
  4. Exception is thrown

Expected outcome

Dialog should be closed without crashing the application and possibly throw OperationCanceledException on the invoking call stack (I don't really care whether the exception is thrown or not).

Repo

https://github.com/Retik/ShowMessageBugExample

Environment

  • MahApps.Metro: v1.6.1
  • Windows OS: Windows 10 Enterprise v1709
  • Visual Studio: 2017 Enterprise v15.6.4
  • .NET Framework: v4.6.1
@punker76 punker76 self-assigned this Apr 4, 2018
@punker76 punker76 added the Bug label Dec 14, 2018
@Erik-White
Copy link

I have the exact same issue, it is still present in the latest 2.x prerelease build
It would be great if it could be fixed, very handy for easily closing a dialog on a timeout or when it's no longer relevant due to a task cancellation

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

Successfully merging a pull request may close this issue.

3 participants