Open T-Gro opened 1 year ago
Hi all, is there anything else I should improve here, or is this ready to be merged now?
I need time to think this through and understand what breaking changes it could cause. I'm really busy right now, so I don't know when I'll get to that.
@JamesNK : Hi James, would now be a better time to merge this in please?
This addresses #1295 , specifically the part which started to regress after F#7 added the "readonly" modified to compiler generated records.
The solution is to adjust the heuristic in order to find a good fitting parametrized constructor, and avoid fallback to default one. Why did this work before? Because a default constructor was used, and private property/field injected later. However, with the "readonly" modifier, field injection no longer works.
This was always working fine without using mapping attributes, because newtonsoft found a constructor argument by its name. The change in this PR just extends this to also look for constructor argument using the underlying name, and not just the name of the JSON property.