Description
A ContentPage that has a ToolbarItem with a Clicked event handler is not garbage collected after being dismissed when presented modally via Navigation.PushModalAsync. The same page is collected correctly when pushed via Navigation.PushAsync.

Steps to Reproduce
- Create a
ContentPage with a ToolbarItem that has a Clicked event handler
- Push it modally via
Navigation.PushModalAsync(new NavigationPage(page))
- Dismiss it via
Navigation.PopModalAsync()
- Repeat a few times
- Force GC and check if pages were collected
Link to public reproduction project repository
https://github.com/Vetle444/MauiTestApp/tree/toolbarMemoryLeak
Version with bug
10.0.50
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Android, iOS
Affected platform versions
No response
Did you find any workaround?
Use Command instead
Relevant log output
Description
A
ContentPagethat has aToolbarItemwith aClickedevent handler is not garbage collected after being dismissed when presented modally viaNavigation.PushModalAsync. The same page is collected correctly when pushed viaNavigation.PushAsync.Steps to Reproduce
ContentPagewith aToolbarItemthat has aClickedevent handlerNavigation.PushModalAsync(new NavigationPage(page))Navigation.PopModalAsync()Link to public reproduction project repository
https://github.com/Vetle444/MauiTestApp/tree/toolbarMemoryLeak
Version with bug
10.0.50
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Android, iOS
Affected platform versions
No response
Did you find any workaround?
Use Command instead
Relevant log output