mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
fix: use new serializer cache per IXmlSerializer (#11356)
This commit is contained in:
parent
6fb6b5f176
commit
133b568a35
1 changed files with 2 additions and 3 deletions
|
|
@ -15,10 +15,9 @@ namespace Emby.Server.Implementations.Serialization
|
||||||
{
|
{
|
||||||
// Need to cache these
|
// Need to cache these
|
||||||
// http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html
|
// http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html
|
||||||
private static readonly ConcurrentDictionary<string, XmlSerializer> _serializers =
|
private readonly ConcurrentDictionary<string, XmlSerializer> _serializers = new();
|
||||||
new ConcurrentDictionary<string, XmlSerializer>();
|
|
||||||
|
|
||||||
private static XmlSerializer GetSerializer(Type type)
|
private XmlSerializer GetSerializer(Type type)
|
||||||
=> _serializers.GetOrAdd(
|
=> _serializers.GetOrAdd(
|
||||||
type.FullName ?? throw new ArgumentException($"Invalid type {type}."),
|
type.FullName ?? throw new ArgumentException($"Invalid type {type}."),
|
||||||
static (_, t) => new XmlSerializer(t),
|
static (_, t) => new XmlSerializer(t),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue