-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
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.