According to the MSDN documentation for the OnDeserialized
attribute:
When applied to a method, specifies that the method is called immediately after deserialization of an object in an object graph. The order of deserialization relative to other objects in the graph is non-deterministic.
the method OnDeserialize is called after the object was deserialized but (to my understanding) not necessarily after all aggregated objects were also deserialized.
You are performing an operation in your OnDeserialized
method which uses the aggregated animations_
dictionary containing AnimationManager
objects which must also be deserialized. If OnDeserialized
is called before the AnimationManager
objects are deserialized, it would explain the symptoms you described.
Best you call the method yourself and remove the OnDeserialized
attribute.