Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make top-level serialization context accessible to custom serializers #235

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

henbagle
Copy link

@henbagle henbagle commented Oct 5, 2024

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?

…ext object, if available, as the parent of the created serialization context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IBinarySerializable - Access to the optional SerializationContext on serialization and deserialization
1 participant