fix: use new serializer cache per IXmlSerializer (#11356)

pull/11363/head
Cody Robibero 3 weeks ago committed by GitHub
parent 6fb6b5f176
commit 133b568a35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,10 +15,9 @@ namespace Emby.Server.Implementations.Serialization
{
// Need to cache these
// http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html
private static readonly ConcurrentDictionary<string, XmlSerializer> _serializers =
new ConcurrentDictionary<string, XmlSerializer>();
private readonly ConcurrentDictionary<string, XmlSerializer> _serializers = new();
private static XmlSerializer GetSerializer(Type type)
private XmlSerializer GetSerializer(Type type)
=> _serializers.GetOrAdd(
type.FullName ?? throw new ArgumentException($"Invalid type {type}."),
static (_, t) => new XmlSerializer(t),

Loading…
Cancel
Save