BinarySerializer icon indicating copy to clipboard operation
BinarySerializer copied to clipboard

Make top-level serialization context accessible to custom serializers

Open henbagle opened this issue 1 year ago • 0 comments

This fixes #229 where the optional serialization context is not accessible to BinarySerializationContext tree when working with an IBinarySerializable class.

I think it's a little quirky that when traversing up the SerializationContext tree there are two BinarySerializationContext nodes with the same value (the root), and now the optional context above that, but this preserves the existing behavior of the framework.

I also noticed that passing in a primitive type like a string for the optional context will not save the context into the RootValueNode, as it only looks for children objects, but that's out of scope for the issue I was facing.

I have no idea if I've solved the problem in a correct way, but it works for my use case. I'm newer to the library side of things, does changing CreateSerializationContext from private to protected virtual count as a breaking change?

henbagle avatar Oct 05 '24 19:10 henbagle