diff --git a/osu.Game/Online/SignalRUnionWorkaroundResolver.cs b/osu.Game/Online/SignalRUnionWorkaroundResolver.cs index 21413f8285..89052ad052 100644 --- a/osu.Game/Online/SignalRUnionWorkaroundResolver.cs +++ b/osu.Game/Online/SignalRUnionWorkaroundResolver.cs @@ -35,7 +35,9 @@ public class SignalRUnionWorkaroundResolver : IFormatterResolver typeof(TeamVersusUserState), }; - private static readonly IReadOnlyDictionary formatter_map = new Dictionary + private static IReadOnlyDictionary formatterMapBacking; + + private static IReadOnlyDictionary formatterMap => formatterMapBacking ??= new Dictionary { { typeof(TeamVersusUserState), new TypeRedirectingFormatter() }, { typeof(TeamVersusRoomState), new TypeRedirectingFormatter() }, @@ -51,7 +53,7 @@ public class SignalRUnionWorkaroundResolver : IFormatterResolver public IMessagePackFormatter GetFormatter() { - if (formatter_map.TryGetValue(typeof(T), out var formatter)) + if (formatterMap.TryGetValue(typeof(T), out var formatter)) return (IMessagePackFormatter)formatter; return StandardResolver.Instance.GetFormatter();