Skip to content

Generated name is wrong for generic types with many type parameters #6392

Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Product

Hot Chocolate

Describe the bug

When using a type with more than nine generic arguments, the generated GraphQL-name incorrectly contains a '_'.

See example.

Steps to reproduce

    public class Query
    {
        // Generated name (OK): NineGenericsOfInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32
        public NineGenerics<int, int, int, int, int, int, int, int,int> TestNine => default!;

        // Generated name (WRONG): TenGenerics_OfInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32
        public TenGenerics<int, int, int, int, int, int, int, int,int, int> TestTen => default!;
    }


    public class NineGenerics<T1, T2, T3, T4, T5, T6, T7, T8, T9>
    {
        public int Foo { get; set; }
    }
    public class TenGenerics<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
    {
        public int Foo { get; set; }
    }

image

Relevant log output

No response

Additional Context?

I case you wonder why someone would use types with that many arguments: We use them to represent strictly typed data tables (T1 = Type of column 1, T2 = Type of column 2 etc. etc.)

Is suspect the bug to happen somewhere around here

name = name.Substring(0, name.Length - _typePostfix.Length);
(anyways, I haven't verified this)

Version

13.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions