System.text.json source gen trying to index private field even if it has [JsonIgnore] attrib

Hi, there are certain fields in my POCO data class that I don’t want to serialize/deserialize so I made them private, but the Source Generator is still trying to index/scan them even though they have the [JsonIgnore] attribute.

I know this is an issue with earlier versions of the runtime, but has anyone tried using anything greater than version 6.0.0 of the System.Text.Json library? We’re on Unity 6000.0.67 using .NET Framework.

If not I guess my only option would be to write my own converter but I’d rather not

If you can switch to .NET Standard (highly recommended) you can update System.Text.Json, that should work without issues.

But if you have some code that absolutely relies on .NET Framework still consider refactoring this so you can switch to .NET Standard. Framework is on its way out, hasn’t been the default for years, and within 1-2 years you’d be barred from udpating to the latest Unity version due to the switch to CoreCLR.