You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, and thank you for the fantastic UI framework!
When I open a window which is a subclass of AdonisWindow, then close it, then force a garbage collection pass, the finalizer for the window is not called, even though my code has no references to the window. If I change the window so that it derives directly from System.Windows.Window, then the finalizer is called as expected when I force a GC after closing the window.
I am fairly new to WPF so I may be doing something wrong and missing something obvious, but I am able to reproduce this in a very simple application.
To reproduce:
Create an application with two window classes, MainWindow and SecondaryWindow.
Add the usual Adonis resources to App.xaml, Dark or Light theme, doesn't matter which.
Modify SecondaryWindow such that it derives from AdonisWindow.
Add a finalizer to SecondaryWindow and in the finalizer, add a Debug.WriteLine statement in order to know when the finalizer is called.
On MainWindow, add a button labeled "Open Window" and in its codebehind handler, instantiate SecondaryWindow and display it with Show().
On MainWindow, add another button labeled "Collect" and in its codebehind handler, call GC.Collect() and GC.WaitForPendingFinalizers() and then GC.Collect() again, to ensure all unreferenced objects are collected.
Run the application, press the "Open Window" button.
After the SecondaryWindow opens, close it with the X.
Press the "Collect" button, and observe that the SecondaryWindow finalizer is not called.
If you change SecondaryWindow to derive directly from System.Windows.Window, then the finalizer is called.
The expectation is that the SecondaryWindow will be fully unreferenced after it is closed, and its finalizer will be called when a full garbage collection occurs.
The text was updated successfully, but these errors were encountered:
I've attached an app that reproduces the problem. It has two buttons, one to create an Adonis window, and the other to create a regular window that does not derive from AdonisWindow. You can see that the Adonis windows are not garbage collected, while the regular windows are. AdonisMemoryLeakTest.zip
Hello, and thank you for the fantastic UI framework!
When I open a window which is a subclass of AdonisWindow, then close it, then force a garbage collection pass, the finalizer for the window is not called, even though my code has no references to the window. If I change the window so that it derives directly from System.Windows.Window, then the finalizer is called as expected when I force a GC after closing the window.
I am fairly new to WPF so I may be doing something wrong and missing something obvious, but I am able to reproduce this in a very simple application.
To reproduce:
If you change SecondaryWindow to derive directly from System.Windows.Window, then the finalizer is called.
The expectation is that the SecondaryWindow will be fully unreferenced after it is closed, and its finalizer will be called when a full garbage collection occurs.
The text was updated successfully, but these errors were encountered: