Serialization problem on custom event handlerSerialization problem on custom event handler
Old forum URL: forums.lhotka.net/forums/t/1651.aspx
dean posted on Tuesday, October 31, 2006
Have a situation where a custom eventhandler and serialization is not playing nicely together.
this is my object structure:
Root (Order)
ChildCollection (OrderDetails)
Child (OrderDetail)
ChildChild (OrderPrice)
Childchild (OrderSize)
In both the childChild objects and in the OrderDetail object I have custom events that communicate price changes between the three objects and up to the root object. I declared these as outlined in the book with the nonserialized attribute on the mNonSerializableHandlers variable and then the Public Custom Event... code.
Now when beginEdit is called on the child and a copystate occurs this cascades down to the ChildChild objects. But these serializations of the childchild are both putting a huge amount of data on the stack (and eventually out of memory exceptions). Note: this is not happening on the child - it serializes just fine.
I added NotUndoable to the NonSerialized attribute on the mNonSerializeHandler declaration and that seems to fix the problem. But I of course don't really understand why the serialization of the child is working fine but the serialization of the childchild is not working. I think it has something to do with the undoablebase code.
Any thoughts?
DeanCopyright (c) Marimer LLC