While debugging in Visual Studio 2013, I'd like to know the number of subscribers to the event PropertyChanged
published by a certain class (let's call it Publisher
) that implements INotifyPropertyChanged
.
I've researched a bit and found that this should be possible calling GetInvocationList()
and counting the elements in the returned array. So I've set a breakpoint in my code and tried to call this on an object called publisher
of class Publisher
in the Immediate window:
publisher.PropertyChanged.GetInvocationList()
However, I get this error message:
The event 'System.ComponentModel.INotifyPropertyChanged.PropertyChanged' can only appear on the left hand side of += or -=
What's wrong with what I've done?
How can I access the subscribers to PropertyChanged
?