From 133b568a35d5ce3c856eae65319796dc3e08361e Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Sun, 14 Apr 2024 17:01:59 -0600 Subject: [PATCH] fix: use new serializer cache per IXmlSerializer (#11356) --- Emby.Server.Implementations/Serialization/MyXmlSerializer.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs b/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs index 1bac2600ca..aa5fbbdf73 100644 --- a/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs +++ b/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs @@ -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 _serializers = - new ConcurrentDictionary(); + private readonly ConcurrentDictionary _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),