We are calling 'Session.NotifyChanged()' directly after 'ApplyChanges()'. In the shown case we had previously removed an entity by 'Entity.Remove' and the entity is removed from the DB correctly. But then 'NotifyChanged()' calls the 'PropertyChanged' event of our removed entity with argument 'null'. This leads to a full refresh which tries to access the properties (ie. 'Z_Name') and that access throws an exception in 'Storage.Entity.EnsureNotRemoved()'. I would suggest that 'NotifyChanged()' doesn't call 'PropertyChanged' for any entity that has the 'IsRemoved' flag set.
Stack trace:
Xtensive.Storage.dll!Xtensive.Storage.Entity.EnsureNotRemoved() Line 406 C#
Xtensive.Storage.dll!Xtensive.Storage.Entity.SystemBeforeGetValue(Xtensive.Storage.Model.FieldInfo field = "Z_Name"; Attributes = Nullable | Declared) Line 541 + 0xd bytes C#
Xtensive.Storage.dll!Xtensive.Storage.Persistent.GetFieldValue<string>(Xtensive.Storage.Model.FieldInfo field = "Z_Name"; Attributes = Nullable | Declared) Line 223 + 0x1e bytes C#
Xtensive.Storage.dll!Xtensive.Storage.Persistent.GetFieldValue<string>(string fieldName = "Z_Name") Line 194 + 0xa7 bytes C#
KLIBDatabase.dll!Diartis.KLIB.Model.FieldDefinition.Z_Name.get() + 0x4e bytes C#
KLIBDatabase.dll!Diartis.KLIB.Model.FieldDefinition.NameP.get() Line 235 + 0x28 bytes C#
KLIBViewModel.dll!Diartis.KLIB.KLIBViewModel.VMFieldDefinition.NameP.get() Line 157 + 0x3f bytes C#
KLIBViewModel.dll!Diartis.KLIB.KLIBViewModel.VMFieldDefinition.OnPropertyChanged(object sender = null, System.ComponentModel.PropertyChangedEventArgs e = {System.ComponentModel.PropertyChangedEventArgs}) Line 22 + 0x2c bytes C#
KLIBViewModel.dll!Diartis.KLIB.KLIBViewModel.VMEntity.OnModelEntityPropertyChanged(object sender = null, System.ComponentModel.PropertyChangedEventArgs e = {System.ComponentModel.PropertyChangedEventArgs}) Line 131 + 0x80 bytes C#
Xtensive.Storage.dll!Xtensive.Storage.Session.NotifyChanged() Line 41 + 0x68 bytes C#
KLIBDatabase.dll!Diartis.KLIB.Model.ModelContext.SaveChanges() Line 406 + 0x28 bytes C#
This thread was imported from our support forum. The original discussion may contain more detailed answer.
Original topic by AndresRohr.
asked
Jul 29 '10 at 14:54
Editor
46●156●156●157
To be fixed, issue: http://code.google.com/p/dataobjectsdot ... ail?id=770