Table of Contents

GR0064: Do not use new instances of JsonSerializerOptions. Reuse existing instances for better performance.

TitleDo not use new instances of JsonSerializerOptions. Reuse existing instances for better performance.
IdGR0064
CategoryPerformance
Default SeverityWarning
Enabled By DefaultTrue
DescriptionReuse JsonSerializerOptions instances for better performance. Creating new instances repeatedly causes the metadata cache to be rebuilt each time. The metadata caches on the options instance are thread-safe, and the instance is immutable after the first serialization or deserialization.
Custom Tags