Skip to content

Conversation

bart-degreed
Copy link
Contributor

@bart-degreed bart-degreed commented Feb 14, 2020

Bugfix: Respect customizations on JsonSerializerSettings when serializing response.

Fixes #687.

@bart-degreed bart-degreed changed the title Bugfix: Respect customizations on JsonSerializerSettings when seriali… Bugfix: Respect customizations on JsonSerializerSettings Feb 14, 2020
@bart-degreed bart-degreed requested a review from maurei February 14, 2020 13:57
@bart-degreed
Copy link
Contributor Author

I've come to realize that JsonSerializerSettingsNullValueHandlingScope was a very bad idea: Changing options on the shared instance will likely affect concurrent requests. As described here, locking is not going to help.

The right way to deal with this is to have the settings copied into a new serializer instance. There is no Clone method, but calling JsonSerializer.Create(settings) does perform the copy internally. As an optimization, we may even cache the JsonSerializer instance (it is thread-safe).

@bart-degreed
Copy link
Contributor Author

Replaced by #720.

@bart-degreed bart-degreed deleted the serializer-settings branch April 10, 2020 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bug: custom serializer settings are ignored

1 participant