❔ ✅ 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
sinaesthetic2y 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
sinaesthetic2y ago
It might be specifically Dictionary<string, object>
sinaesthetic
sinaesthetic2y ago
sinaesthetic
sinaesthetic2y 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
sinaesthetic2y ago
Difference is, this issues says it was throwing, but mine is simply being ignored
sinaesthetic
sinaesthetic2y ago
sinaesthetic
sinaesthetic2y 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
sinaesthetic2y 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.