Closed as not planned
Description
Describe the bug
The RelayCommand
is leaking the command's subscriber when command's lifespan is bigger than the subscribers (i.e. singleton command with a Button
subscriber within a pop-able page).
Regression
No response
Steps to reproduce
Check out this repository's branch: https://github.com/albyrock87/maui-shell-issues/tree/relay-command-leak
- Start the iOS app
- Tap on
Open sub page
- Press back
- See the message saying that the button's reference is still alive
Now comment [RelayCommand]
and uncomment the standard ICommand
implementation above.
Repeat the steps and notice how the reference is gone.
https://github.com/albyrock87/maui-shell-issues/blob/relay-command-leak/BarPage.xaml.cs#L12-L31
Expected behavior
GC should be able to collect the command subscriber as it does with Command
.
Screenshots
No response
IDE and version
Rider
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.3.2
Additional context
Help us help you
No, just wanted to report this