Allows client code to avoid tripping over StandardResolver by AArnott · Pull Request #1315 · MessagePack-CSharp/MessagePack-CSharp · GitHub
Skip to content

Allows client code to avoid tripping over StandardResolver#1315

Merged
AArnott merged 1 commit into
MessagePack-CSharp:developfrom
AArnott:fix832
Sep 2, 2021
Merged

Allows client code to avoid tripping over StandardResolver#1315
AArnott merged 1 commit into
MessagePack-CSharp:developfrom
AArnott:fix832

Conversation

@AArnott

@AArnott AArnott commented Aug 22, 2021

Copy link
Copy Markdown
Collaborator

In AOT-only environments it seems it was impossible to avoid loading StandardResolver because the MessagePackSerializer had a static property with an initializer that loaded the StandardResolver.
After this change, if the DefaultOptions getter is never called, or its setter is called first, then the StandardResolver can be avoided.

Fixes #832

@AArnott AArnott added this to the v2.4 milestone Aug 22, 2021
@AArnott AArnott requested a review from neuecc August 22, 2021 00:03
@AArnott AArnott self-assigned this Aug 22, 2021
In AOT-only environments it seems it was impossible to avoid loading `StandardResolver` because the `MessagePackSerializer` had a static property with an initializer that loaded the `StandardResolver`.
After this change, if the `DefaultOptions` getter is never called, or its setter is called first, then the `StandardResolver` can be avoided.

Fixes MessagePack-CSharp#832

@neuecc neuecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I often work on issues related to AOT and loading, but I think more carefully about these patterns.

@AArnott AArnott merged commit edbf65e into MessagePack-CSharp:develop Sep 2, 2021
@AArnott AArnott deleted the fix832 branch September 2, 2021 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants