As PropertyChanged (PropertyChangedEventHandler in C#) implements the weak event pattern. Are you required to unsubscribe from it in a Dispose routine to prevent a memory leak/the object failing to be GCd?
My first guess is that if this is indeed a weak event pattern then putting a call to remove the event handler in the Dispose routine may actually mean you prevent the object with the PropertyChanged eventhandler from being GCd until Dispose is called.
So in the case of a weak reference event, unsubscribing from your events may actually mean more memory usage and a longer object lifetime. Is this correct?
PropertyChangedEventHandler
implements the weak event pattern? I didn't find any evidence for that claim in the official documentation.PropertyChanged
is an event onINotifyPropertyChanged
.PropertyChangedEventHandler
is a delegate. Neither of these is tied to a weak event implementation. Perhaps you are using thePropertyChangedEventManager
(not mentioned in question). Please clarify.