Description
When a ContentPage is pushed as a modal wrapped in a NavigationPage via Navigation.PushModalAsync(new NavigationPage(page)), neither the NavigationPage, the inner ContentPage, nor any of their child views are garbage collected after calling PopModalAsync.
A plain modal page (without NavigationPage wrapping) is collected correctly.
This works correctly on iOS.

Steps to Reproduce
- Clone https://github.com/Vetle444/MauiTestApp/tree/modalMemoryLeak
- Tap
ModalPageNotCleanedUp
- Tap
Push Modal Page in NavigationPage
- Close it
- Tap
Force GC & Check Cleanup
- Notice that everything is still alive
Link to public reproduction project repository
https://github.com/Vetle444/MauiTestApp/tree/modalMemoryLeak
Version with bug
10.0.50
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.100 SR10
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Check PR in DIPS.Mobile.UI for workaround: DIPSAS/DIPS.Mobile.UI#818, specifically StackNavigationManagerWorkaround class
Relevant log output
Description
When a
ContentPageis pushed as a modal wrapped in aNavigationPageviaNavigation.PushModalAsync(new NavigationPage(page)), neither theNavigationPage, the innerContentPage, nor any of their child views are garbage collected after callingPopModalAsync.A plain modal page (without
NavigationPagewrapping) is collected correctly.This works correctly on iOS.
Steps to Reproduce
ModalPageNotCleanedUpPush Modal Page in NavigationPageForce GC & Check CleanupLink to public reproduction project repository
https://github.com/Vetle444/MauiTestApp/tree/modalMemoryLeak
Version with bug
10.0.50
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.100 SR10
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Check PR in DIPS.Mobile.UI for workaround: DIPSAS/DIPS.Mobile.UI#818, specifically
StackNavigationManagerWorkaroundclassRelevant log output