-
Notifications
You must be signed in to change notification settings - Fork 752
Breaking Changes for FastSerialization #2121
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
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.
| return ret; | ||
| } | ||
|
|
||
| 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.
cincuranet
left a comment
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. |
Code updates are based on microsoft/perfview#2121 Would like to incorporate microsoft/perfview#2180 into dotnet-monitor, to potentially improve memory usage. ~~Test failures are most likely due to changes from microsoft/perfview#2170 Fixed with newest version
Implements a set of breaking changes for
FastSerialization.Highlights:
SerializationSettingsare now required when creating a stream for use withFastSerialization.Deserializerbefore they can be deserialized. Failure to do so will cause the deserialization operation to fail.More Details:
SerializationConfigurationtoSerializationSettingsand make it a required parameter when creating a stream for use withFastSerialization.SerializationSettingsread-only once passed into a reader or writer implementation by cloning the object whenever a setting is changed.StreamReaderAlignmentfrom an optional parameter to reader constructors to a property onSerializationSettings.Deserializerbefore they can be deserialized. Failure to do so will cause the deserialization operation to fail. Registration can occur via a call toDeserializer.RegisterTypeorDeserializer.RegisterFactory.Deserializeralso supports on-the-fly registration of types and factories via theDeserializer.OnUnregisteredTypeevent.Deserializer.RegisterDefaultFactoryandDeserializer.TypeResolverin favor ofDeserializer.OnUnregisteredTypewhich allows for type resolution and factory creation to be performed in one place instead of two.