FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix duplicate registration of named tuples by honda-tatsuya · Pull Request #1464 · MessagePack-CSharp/MessagePack-CSharp · GitHub

fix duplicate registration of named tuples - #1464

Merged
AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
honda-tatsuya:fix-tuple
Nov 19, 2022
Merged

AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
honda-tatsuya:fix-tuple

Conversation

honda-tatsuya commented Jul 8, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor

Example

using MessagePack;
using System.Collections.Generic;

[MessagePackObject]
public class Test
{
    [Key(0)] public Dictionary<((int A, int B) C, (int D, int E) F), ((int G, int H) I, (int J, int K) L)> Hoge;
    [Key(1)] public ((int M, int N) O, (int P, int Q) R)[,] Fuga;
}

Before

        static GeneratedResolverGetFormatterHelper()
        {
            lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(12)
            {
                { typeof(((int A, int B) C, (int D, int E) F)), 0 },
                { typeof(((int G, int H) I, (int J, int K) L)), 1 },
                { typeof(((int M, int N) O, (int P, int Q) R)), 2 },
                { typeof(((int M, int N) O, (int P, int Q) R)[,]), 3 },
                { typeof((int A, int B)), 4 },
                { typeof((int D, int E)), 5 },
                { typeof((int G, int H)), 6 },
                { typeof((int J, int K)), 7 },
                { typeof((int M, int N)), 8 },
                { typeof((int P, int Q)), 9 },
                { typeof(global::System.Collections.Generic.Dictionary<((int A, int B) C, (int D, int E) F), ((int G, int H) I, (int J, int K) L)>), 10 },
                { typeof(global::Test), 11 },
            };
        }

This is runtime error
ArgumentException: An item with the same key has already been added. Key: System.ValueTuple`2[System.Int32,System.Int32]

After

        static GeneratedResolverGetFormatterHelper()
        {
            lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(5)
            {
                { typeof(((int, int), (int, int))), 0 },
                { typeof(((int, int), (int, int))[,]), 1 },
                { typeof((int, int)), 2 },
                { typeof(global::System.Collections.Generic.Dictionary<((int, int), (int, int)), ((int, int), (int, int))>), 3 },
                { typeof(global::Test), 4 },
            };
        }

honda-tatsuya changed the title Fix order of Generic and Tuple fix duplicate registration of named tuples Jul 11, 2022

neuecc commented Jul 11, 2022

Copy link
Copy Markdown
Member

thanks, it seems good.
approve to merge.

AArnott commented Jul 14, 2022

Copy link
Copy Markdown
Collaborator

@honda-tatsuya Thanks for your contribution. Can you please review the test failures and address them?

github-actions Bot commented Nov 1, 2022

Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions Bot closed this Nov 7, 2022
neuecc reopened this Nov 18, 2022

Copy link
Copy Markdown
Contributor Author

@AArnott I fixed it. sorry for the delay.

AArnott merged commit 5a138c4 into MessagePack-CSharp:master Nov 19, 2022
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL