Hi John,
I'm sorry that you had to lost your weekend for this issue.
It appears that we have missed to include this change in the release notes. Thank you for point it. We will update our release notes to include this change. I've updated your telerik points.
As for the change I'll try to explain it in details:
Before 2011 Q1 our DelegateCommand was using normal CanExecuteChanged event. RadControls that support ICommand are using instance field to keep a reference to this event when Command property is set.
In this scenario if you have a ViewModel that expose ICommand (and internally use our DelegateCommand) then you will observe memory leak - e.g. when the view is changed it will not be released from memory because the DelegateCommand will keep a reference to it so that it can call the delegate.
We had to change DelegateCommand in order to prevent this memory leak. Now the problem that arise from this change is that controls that do not keep reference to CanExecuteChanged event handler (like ButtonBase) will lose this reference when garbage collector starts.
There was another solution - to keep DelegateCommand and change all controls to keep weak references to CanExecuteChanged handler. But this would cause all other (non RadControls like ButtonBase) to do memory leak. (ButtonBase does not provide virtual method when Command property changed so we could not fix it).
In the end there is no perfect solution - if controls keep strong reference to CanExecuteChanged handler then the command should use weak event pattern internally to prevent memory leak. If controls do not keep reference (or keep weak reference) to CanExecuteChanged handler Command should NOT use weak event pattern or event handlers will be garbage collected.
I hope that this justify our decision.
All the best,
Hristo
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>