Skip to content

App and MainWindow Destructors Not Being Called #10102

Closed Answered by DarranRowe
hamu777 asked this question in Q&A
Discussion options

You must be logged in to vote

As WinUI 3 is currently implemented, the Xaml runtime will never release the last reference it holds to the application object. So yes, it is expected that the destructors for App and any objects held in App will not be called. There is no requirement in Windows for an application to explicitly release all memory used back to Windows as the operating system reclaims all of this memory when the process is exited.
There is no correct way to force App to be destroyed when the application exits, but it is possible to customise the main function and get App to release any objects that it owns.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hamu777
Comment options

Answer selected by hamu777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants