Closed FantasticFiasco closed 8 years ago
The CommandManager approach sounds like good idea and any hint on this would be appreciated. I will soon change RelayCommand to an async approach, but the underlying functionality would be the same so the memory leak needs to be addressed.
It seems like my WPF knowledge is a bit outdated. I looked at both MVVM Light and Prism, and they no longer are defensive against the memory leak. That makes me believe that it no longer is a problem.
I've been away from WPF for quite some time, but in previous versions of .NET there was a memory leak if you declared your
CanExecuteChanged
as you do in the classRelayCommand
.What one could do was to use a weak event (as you say in the note), but the easiest way was to pass on the handler to the
CommandManager
.If you choose to go with the
CommandManager
, that is an easy fix and I can have a PR for you this evening.