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

Static Object Context for Ahead of Time compiling and Trimmed libraries #758

Merged
merged 8 commits into from
Dec 19, 2022

Conversation

EdwardCooke
Copy link
Collaborator

Includes a source generator/analyzer that generate a static type inspector and object factory. These static objects allow the creation of objects and setting/getting of object properties and fields so YamlDotNet serializer will work with trimmed libraries and ahead of time compilation because it removes the use of reflection when these static objects are used during serialization and deserialization.

Currently it has the following requirements, support and limitations:

  • All objects in the YAML object graph must be annotated with the YamlSerializable attribute
  • YamlIgnore and YamlMember attributes are supported and respected
  • Dictionary<,> and List<> property/field types are supported.
  • There is a helper method on the SerializerBuilder and DeserializerBuilder that will configure the serializer and deserializer to not use the reflection based objects and instead use the static ones.
  • Arrays are supported
  • Type overrides are not tested, if you annotate the real class with YamlSerializable it might work

This PR will not create or push an analyzer package to NuGet. That will come later.

This is to support creating an analyzer package manually that can be tested by the users in #740 and #753.

@aaubry , I know you are trying to take a more passive role in YamlDotNet, but I would really appreciate a review of this and the subsequent PR, at a potentially near future date, where we push up the official analyzer so people can use it for real.

@EdwardCooke EdwardCooke merged commit 1ff1a86 into aaubry:master Dec 19, 2022
@aaubry
Copy link
Owner

aaubry commented Dec 19, 2022

This feature has been released in version 12.3.0.

@EdwardCooke EdwardCooke deleted the ec-aot branch August 14, 2023 05:49
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.

None yet

2 participants