I've run into a really strange problem I can't seem to reproduce with a small example. Sorry if this question is a little vague.
I have a Person which contains an Address. Both inherit from BaseEntity which implements INotifyPropertyChanged. I want the Person class to NotifyPropertyChanged("Address") not only when an Address is set, but also when that Address itself changes, so my get/set in Person looks like this:
class Person : BaseEntity
{
private Address address;
public Address Address
{
get { return address; }
set
{
address = value;
NotifyPropertyChanged("Address");
// propagate changes in Address to changes in Person
address.PropertyChanged += (s, e) => { NotifyPropertyChanged("Address"); };
}
}
...
}
This has worked nicely for months.
I've added [Serializable] to Person, Address, and BaseEntity (and [field: NonSerialized] to BaseEntity's PropertyChanged), and now when I make a change to Address (somePerson.Address.Street = "something new") that address's PropertyChanged's invocationCount is 0 where it used to be 1, so Person doesn't get notified, and doesn't itself fire NotifyPropertyChanged("Address");
Again, if I remove [Serializable] from Person, it works, and if I add it back, it doesn't work. I'm not actually serializing anything yet, I've just added the [Serializable] attribute.
Any ideas?