Is there a way to serialize/deserialize private members with System.Text.Json in source generation mode? #115333
Unanswered
aries-zhang
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm trying to switch to source generation mode with System.Text.Json in a native-AOT enabled app but it does not seem to work with private fields/properties.
Previously (before native AOT enabled, in reflection mode) we had custom json type modifiers like this: Example: Serialize private fields which adds GetValue/SetValue actions to the type, but this no longer seems to work in source generation mode (tried the same type modifier with JsonSerializerContext.WithAddedModifier).
Does anyone know if including private members is possible at all in source generation mode?
Beta Was this translation helpful? Give feedback.
All reactions