Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
Part of #90
Prerequisite for launchdarkly/dotnet-sdk-internal#49
Describe the solution you've provided
I made all targets of the common SDK trim safe using the built in system text json source generators.
Describe alternatives you've considered
The already written converters could be called directly in the places where
LdValueandContextneed to be serialized.Additional context
I do have a test console app that can be published with AOT and then ran to make sure that these items can be serialized properly but wasn't totally sure where I should put it. If that is desired I can add it, just need to know where to put it.
Note
Adopts System.Text.Json source generation for Context/LdValue and updates serializers, converters, and project settings to be AOT/trim friendly.
LdJsonSerializerContextforContext.ToString,LdValue.Parse, andLdValue.ToJsonString.LdJsonSerializerContextwith[JsonSerializable]forLdValueandContext.LdJsonSerializationmethods withRequiresUnreferencedCode/RequiresDynamicCodewarnings and messages.Enum.GetValues<T>()on NET5+ forBigSegmentsStatus,EvaluationErrorKind, andEvaluationReasonKindidentifier mapping.EvaluationReasonKindConverterto use the proper enum type.LangVersionto 9.0 andIsAotCompatibletrue for NET7+ targets.#ifguards.Written by Cursor Bugbot for commit 67e2603. This will update automatically on new commits. Configure here.