Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SignalR union workaround resolver failing on multiple union'd types #16980

Merged
merged 1 commit into from Feb 24, 2022

Conversation

smoogipoo
Copy link
Contributor

Without this, when adding a new union'd type, Messagepack throws the following at startup:

[network] 2022-02-24 11:26:32 [verbose]: SpectatorClient connection error: System.TypeInitializationException: The type initializer for 'osu.Game.Online.SignalRUnionWorkaroundResolver' threw an exception.
[network] 2022-02-24 11:26:32 [verbose]: ---> System.ArgumentException: An item with the same key has already been added. Key: osu.Game.Online.Multiplayer.MatchUserRequest
[network] 2022-02-24 11:26:32 [verbose]: at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
[network] 2022-02-24 11:26:32 [verbose]: at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
[network] 2022-02-24 11:26:32 [verbose]: at System.Collections.Generic.Dictionary`2.AddRange(IEnumerable`1 collection)
[network] 2022-02-24 11:26:32 [verbose]: at System.Collections.Generic.Dictionary`2..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
[network] 2022-02-24 11:26:32 [verbose]: at System.Collections.Generic.Dictionary`2..ctor(IEnumerable`1 collection)
[network] 2022-02-24 11:26:32 [verbose]: at osu.Game.Online.SignalRUnionWorkaroundResolver.createFormatterMap() in /home/smgi/Repos/osu/osu.Game/Online/SignalRUnionWorkaroundResolver.cs:line 32
[network] 2022-02-24 11:26:32 [verbose]: at osu.Game.Online.SignalRUnionWorkaroundResolver..cctor() in /home/smgi/Repos/osu/osu.Game/Online/SignalRUnionWorkaroundResolver.cs:line 22

@smoogipoo smoogipoo changed the title Fix union resolver failing on multiple derived types Fix SignalR union workaround resolver failing on multiple union'd types Feb 24, 2022
Copy link
Member

@frenzibyte frenzibyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the Distinct used to be there but I have removed it without further thought on a "many types to one base type" scenario (see #15684 (comment)).

@peppy peppy merged commit 35302aa into ppy:master Feb 24, 2022
@smoogipoo smoogipoo deleted the fix-union-workaround-resolver branch September 11, 2023 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants