You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a reproduction repository, with a simple project and a simplified.
A simple clone and dotnet build will give you an error like this:
What is expected?
Build should succeed.
What is actually happening?
Build fails.
Relevant log output
Restore complete (0.1s)
gql-duplicatekey-poc failed with 2 error(s) (0.2s)
EXEC : error GQL: An item with the same key has already been added. Key: LocalDate
/Users/david/.nuget/packages/strawberryshake.server/15.0.3/build/StrawberryShake.Server.targets(71,5): error MSB3073: The command"dotnet "/Users/david/.nuget/packages/strawberryshake.server/15.0.3/build/../tools/net9/dotnet-graphql.dll" generate "/Users/david/Development/david-driscoll/gql-duplicatekey-poc" -o "/Users/david/Development/david-driscoll/gql-duplicatekey-poc/obj/Debug/net9.0/berry" -n gql_duplicatekey_poc -a md5 -t" exited with code 1.
Build failed with 2 error(s) in 0.6s
Additional context
Now curiously if I comment out all the usages of LocalDate, LocalTime and LocalDateTime the project builds.
I tried debugging to no avail, I don't know whats going on, lol. Input or output it doesn't appear to matter.
I was able to narrow down the issue appears to be TypeRegistrar.GetUnhandled() returning the duplicate types from the dependencies. How or why, I could not tell you.
The text was updated successfully, but these errors were encountered:
I think i have the same issue in my api, here's my partial stacktrace:
HotChocolate.SchemaException: For more details look at the `Errors` property.
1. An item with the same key has already been added. Key: LocalDate
at HotChocolate.Configuration.TypeInitializer.DiscoverTypes()
at HotChocolate.Configuration.TypeInitializer.Initialize()
at HotChocolate.SchemaBuilder.Setup.InitializeTypes(SchemaBuilder builder, IDescriptorContext context, IReadOnlyList`1 types)
at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context)
at HotChocolate.SchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaAsync(ConfigurationContext context, RequestExecutorSetup setup, RequestExecutorOptions executorOptions, IServiceProvider schemaServices, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)
i've tried to use version: 15.1.0-p.3 without success.
Like @david-driscoll, if I remove my LocalDate Property it works.
Here's a small example on how i locally reproduce the issue:
public class Query
{
// this crash, I must comment for the sdl to successfully generate
public List<Failure> GetFailure()
=> [new Failure() { Name = "yo", Date = LocalDate.MinIsoValue }];
public List<Success> GetSuccess()
=> [new Success() { Name = "yo" }];
}
public class Failure
{
public string Name { get; set; }
public LocalDate Date { get; set; }
}
public class Success
{
public string Name { get; set; }
}
i'm using the HotChocolate.Types.NodaTime package right now but I believe even before it was causing problem without the package (I was always using NodaTime LocalDate type in my domain)
Product
Strawberry Shake
Version
15.0.3
Link to minimal reproduction
https://github.com/david-driscoll/gql-duplicatekey-poc
Steps to reproduce
I've created a reproduction repository, with a simple project and a simplified.
A simple clone and
dotnet build
will give you an error like this:What is expected?
Build should succeed.
What is actually happening?
Build fails.
Relevant log output
Additional context
Now curiously if I comment out all the usages of
LocalDate
,LocalTime
andLocalDateTime
the project builds.You can see the diff here for the successful build: david-driscoll/gql-duplicatekey-poc@a3ef895
The working branch is: https://github.com/david-driscoll/gql-duplicatekey-poc/tree/working
The failing branch is: https://github.com/david-driscoll/gql-duplicatekey-poc/tree/master
I tried debugging to no avail, I don't know whats going on, lol. Input or output it doesn't appear to matter.
I was able to narrow down the issue appears to be
TypeRegistrar.GetUnhandled()
returning the duplicate types from the dependencies. How or why, I could not tell you.The text was updated successfully, but these errors were encountered: