Skip to content

Conversation

@honda-tatsuya
Copy link
Contributor

@honda-tatsuya honda-tatsuya commented Jul 8, 2022

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 honda-tatsuya changed the title Fix order of Generic and Tuple fix duplicate registration of named tuples Jul 11, 2022
@neuecc
Copy link
Member

neuecc commented Jul 11, 2022

thanks, it seems good.
approve to merge.

@AArnott
Copy link
Collaborator

AArnott commented Jul 14, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

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 github-actions bot closed this Nov 7, 2022
@neuecc neuecc reopened this Nov 18, 2022
@honda-tatsuya
Copy link
Contributor Author

@AArnott I fixed it. sorry for the delay.

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