-
Notifications
You must be signed in to change notification settings - Fork 710
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
Breaking Changes for FastSerialization #2121
Breaking Changes for FastSerialization #2121
Conversation
- Require an instance of SerializationSettings for serializers and deserializers.
IStreamWriter to allow writers to directly create readers.
usres can't change the set of allowed types after it is set and handed to the deserialization code.
Remove the ability for FastSerialization to create arbitrary types that are specified in serialized files. Instead, force users to register all types before or during serialization. Types can be registered via calls to Deserializer.RegisterType and Deserializer.RegisterFactory. Users can also implement Deserializer.OnUnregisteredType to handle unregistered types encountered during deserialization. It is incumbent on the implementor to not just blindly call Type.GetType in OnUnregisteredType, and instead only create known types.
provide enough context to find the right assembly.
@@ -1979,49 +2039,31 @@ private IFastSerializable ReadObjectDefinition(Tags tag, StreamLabel objectLabel | |||
|
|||
internal Func<IFastSerializable> GetFactory(string fullName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GrabYourPitchforks, you will be most interested in the changes to GetFactory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small nits and comments. Overall LGTM.
src/TraceEvent/TraceEvent.Tests/Serialization/FastSerializerTests.cs
Outdated
Show resolved
Hide resolved
Thanks @cincuranet. I have made all of the suggested changes. |
Implements a set of breaking changes for
FastSerialization
.Highlights:
SerializationSettings
are now required when creating a stream for use withFastSerialization
.Deserializer
before they can be deserialized. Failure to do so will cause the deserialization operation to fail.More Details:
SerializationConfiguration
toSerializationSettings
and make it a required parameter when creating a stream for use withFastSerialization
.SerializationSettings
read-only once passed into a reader or writer implementation by cloning the object whenever a setting is changed.StreamReaderAlignment
from an optional parameter to reader constructors to a property onSerializationSettings
.Deserializer
before they can be deserialized. Failure to do so will cause the deserialization operation to fail. Registration can occur via a call toDeserializer.RegisterType
orDeserializer.RegisterFactory
.Deserializer
also supports on-the-fly registration of types and factories via theDeserializer.OnUnregisteredType
event.Deserializer.RegisterDefaultFactory
andDeserializer.TypeResolver
in favor ofDeserializer.OnUnregisteredType
which allows for type resolution and factory creation to be performed in one place instead of two.