To make a very long story short… This is in a large WPF project
I have a class “Patient” that implements INotifyPropertyChanged
. When I dispose this class I am checking that the PropertyChangedEventHandler
is null and if not run it to a ListenerDetector
class that logs the listeners so we can track them down and clean the leaks. Patient does have some properties that are bound to WPF elements as well as other objects the use its PropertyChanged
to monitor changes.
After disposing everything else, my log result is as follows:
Log: Patient still has the following listener(s) attached: -
System.ComponentModel.PropertyChangedEventManager
Question:
When is the PropertyChangedEventManager
created?
- When Patient is created
- When WPF binds to Patient property
- Some other point.
If Patient.PropertyChangedEventHandler
is set to null
and therefore disconnected from the PropertyChangedEventManager
is there any way to recreate the Manager and have it listen to the Patient.PropertyChangedEventHandler
again? Please don’t ask why this would happen, that is a point of tension here :-(