Describe the bug
Types containing methods with a generic type argument yield the following exception:
HotChocolate.SchemaException: Multiple schema errors occured:
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
Unable to create instance of type ``.
// ...(goes on for a total of 999 errors)
To Reproduce
Steps to reproduce the behavior:
public class Foo
{
public string Bar { get; set; }
public string FooBar<T>() => Bar;
}
FooType : ObjectType<Foo>.FooType with the schemabuilder and notice the exception I mentioned will occur.Removing the <T> generic type argument works around the issue.
Admittedly, the example here doesn't make much sense, but I have a type in my application that uses the generic type to cast an object to T.
Expected behavior
No error should occur.
Desktop (please complete the following information):
Additional context
Hi,
we will remove generic methods from the auto-detection since they do not make sense.
We will integrate the fix in version 10.4.0
Makes sense. Thanks!
After some testing also Methods returning Task without any value seem to cause issues in some scenarios.
Most helpful comment
Hi,
we will remove generic methods from the auto-detection since they do not make sense.
We will integrate the fix in version 10.4.0