In the API, regarding the context of the Request, we need to adjust the Converters available in the Serializer and so we need to clone the serializer before.
otherwise this will throw an exception :
System.InvalidOperationException: This JsonSerializerOptions instance is read-only or has already been used in serialization or deserialization.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializerOptionsReadOnly(JsonSerializerContext context)
at System.Text.Json.JsonSerializerOptions.ConverterList.OnCollectionModifying()
at System.Text.Json.Serialization.ConfigurationList``1.Add(TItem item)
Description
In the API, regarding the context of the Request, we need to adjust the Converters available in the Serializer and so we need to clone the serializer before.
otherwise this will throw an exception :
Related Issues
related to #5275 related to #5144