C
C#4mo ago
230V

✅ deserializing records with STJ results in default values

https://discord.com/channels/143867839282020352/569261465463160900/1273773286311854142 idk why it's null. is there some attribute I don't know about to make it force-assign init?
2 Replies
MODiX
MODiX4mo ago
230V
REPL Result: Success
record R(string S);
System.Text.Json.JsonSerializer.Deserialize<R>(@"{""s"":""asdf""}").S is null
record R(string S);
System.Text.Json.JsonSerializer.Deserialize<R>(@"{""s"":""asdf""}").S is null
Result: bool
True
True
Quoted by
<@461206446282113035> from #void-spam (click here)
Compile: 400.348ms | Execution: 68.859ms | React with ❌ to remove this embed.
MODiX
MODiX4mo ago
Aaron
you need to set a renaming policy either on the type itself or in the options to make that work
Quoted by
<@461206446282113035> from #void-spam (click here)
React with ❌ to remove this embed.
Want results from more Discord servers?
Add your server