❔ ✅ JsonSerializer not serializing dictionary

I see this was an issue in .NET 6 and fixed in 7 however, it seems to still not be working in my project. All of my projects are on .NET 7 now, rebuilt, etc., dictionaries are being ignored. When I try the same code in LinqPad, it works fine. Looking for ideas...
11 Replies
sinaesthetic
sinaestheticOP2y ago
object explorer for System.Text.Json is showing 7.0.1
phaseshift
phaseshift2y ago
News to me. Sure We have plenty of dicts serialised ok in net5 and 6
sinaesthetic
sinaestheticOP2y ago
It might be specifically Dictionary<string, object>
sinaesthetic
sinaestheticOP2y ago
sinaesthetic
sinaestheticOP2y ago
GitHub
System.Text.Json.JsonSerializer does not work with Dictionary · Iss...
Description When a Dictionary&lt;string, object&gt; needs serialization, the .NET default System.Text.Json.JsonSerializer throws an exception: System.InvalidOperationException: Method may o...
sinaesthetic
sinaestheticOP2y ago
Difference is, this issues says it was throwing, but mine is simply being ignored
sinaesthetic
sinaestheticOP2y ago
sinaesthetic
sinaestheticOP2y ago
super weird OMG i need a vacation... nevermind.... the property not being serialized didn't even have a getter setter, it was declared as a field...
phaseshift
phaseshift2y ago
Oof
sinaesthetic
sinaestheticOP2y ago
Yeah I miss the days when the IDE used to color fields differently than properties
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server