diff --git a/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs b/Emby.Server.Implementations/Serialization/MyXmlSerializer.cs index 1bac2600c..aa5fbbdf7 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),