Description
I noticed that sometimes trying to deserialize a session fails with an exception like SerializationException: The object with ID 223 implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other.
.
I'm not 100% sure about it, but it seems like that happens when the serialized session contains an entity that has lazy properties.
Sadly, the stack trace is not helpful:
at System.Runtime.Serialization.ObjectManager.GetCompletionInfo(FixupHolder fixup, ObjectHolder& holder, Object& member, Boolean bThrowIfMissing)
at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
I reproduced it with versions 5.2.7 and 5.3.3.
If I find any additional information I'll add it here later.
If anyone has an idea on how to narrow this down to a specific test case, please tell.
Target Framework is .NET 4.8
Test case: https://gist.github.com/bahusoid/55d8dfc3d02abfb270e4228fe50ab480