-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
MetroWindow OnClosing exception (.Net 4.0) #2476
Comments
punker76
added a commit
that referenced
this issue
Apr 19, 2016
the metroActiveDialogContainer can be null if the window is not loaded
Very fast :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not clear why but, when I close the main window of my application, I receive an exception because the variable metroActiveDialogContainer is null.
I have checked my code and for each MetroWindow loaded I have the same OnClosing event, but when it is closed the last window I receive an additional OnClosing event where the metroActiveDialogContainer is null.
I have applied this fix (MetroWindow.cs line 782):
var dialog = this.Invoke(() => this.metroActiveDialogContainer?.Children.OfType<BaseMetroDialog>().LastOrDefault());
I have only added a Null-conditional operator (“?.”)
Probably the problem is on my side (I think that there is an hidden window that is loaded and not closed in my code) but I think that this fix can be inserted in the 'official' code.
The text was updated successfully, but these errors were encountered: