JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.64k stars 3.24k forks source link

Ensure CamelCasePropertyNamesContractResolver considers NamingStrategy in the cache #2930

Open mahdi-ninja opened 5 months ago

mahdi-ninja commented 5 months ago

CamelCasePropertyNamesContractResolver uses a shared contract cache across all instances but it doesn't consider the fact that sometimes different instances use different naming strategies. https://github.com/JamesNK/Newtonsoft.Json/issues/2927

In our case, we were using CamelCasePropertyNamesContractResolver in our ASP.NET app and then added Elsa Workflow which was using the same resolver with another naming strategy and broke our existing code. It is now fixed in Elsa Workflow (with this PR https://github.com/elsa-workflows/elsa-core/pull/4521) but it took us a long time to understand what was wrong.

mahdi-ninja commented 4 months ago

Hey @JamesNK Do you plan to merge this? It feels like a serious bug to me

narmontas commented 3 months ago

We are having issues as well and would like this to be merged. @JamesNK