Closed DanStory closed 6 months ago
Digging into the issues here more closely, it seems this is expected behavior do to worry of performance degradation of legacy/existing applications..
Personally, I would suggest the CamelCasePropertyNamesContractResolver
be marked with a deprecated message for the implementer to manage the lifetime of DefaultContractResolver instead or at the very least in its documentation describe its shared caching behavior.
Source types
destination JSON
Expected behavior
Contract of type is isolated between two different JsonSerializerSettings
Actual behavior
Contract of type is being shared (with a static cache) across JsonSerializerSettings and serialization
Steps to reproduce
We have an application that interact with multiple different HTTP APIs, each having their own set of serialization rules, and depending on which endpoint is used first (who ever serializes data for a request) ends up causing invalid data for the others due to a shared cache of contracts.