Repository navigation
HotChocolate causes dotnet 8 Blazor application to be incompatible with hot-reload #6695
Description
Activity
- changed the title
[-]HotChocolate with dotnet 8 Blazor application incompatible with hot-reload[/-][+]HotChocolate causes dotnet 8 Blazor application to be incompatible with hot-reload[/+]on Nov 12, 2023 @michaelstaib here's a minimal repro, with a brand new template app on version
14.0.0-p9. It's only about 10 lines of code added to the template. To repro, justdotnet watch run, open a browser to execute a GraphQL request, then make a change toQuery.csto trigger hot reload, and try again:@michaelstaib I've found a work-around that is sucessful about 80% of the time (better than nothing, but still not very workable). My "fix" appears to demonstrate that the
System.InvalidOperationExceptionthrown byMarkInitializedis superfluous, but there must be some case it was designed for..? Is there a summary of whyConventioncannot implementMarkInitializedidempotently? In my years using HotChocolate, 99.999% of my errors have come from this one exception.public class TuneDataTypeInspector : DefaultTypeInspector { protected override void Initialize(IConventionContext context) { // do not call the base class, so it does not throw an exception. if (!IsInitialized) base.Initialize(context); } }When the fix fails, the new error manifests in a way that "forgets" that
ITuneContextis a[Service]passed into the mutation:[10:50:26 ERR] An unhandled exception has occurred while executing the request. HotChocolate.SchemaException: For more details look at the `Errors` property. 1. Unable to infer or resolve a schema type from the type reference `ITuneContext (Input)`. 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) at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaServicesAsync(ConfigurationContext context, RequestExecutorSetup setup, CancellationToken cancellationToken) at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorNoLockAsync(String schemaName, CancellationToken cancellationToken) at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorAsync(String schemaName, CancellationToken cancellationToken) at HotChocolate.Execution.RequestExecutorProxy.GetRequestExecutorAsync(CancellationToken cancellationToken) at HotChocolate.AspNetCore.HttpPostMiddlewareBase.HandleRequestAsync(HttpContext context) at HotChocolate.AspNetCore.HttpPostMiddlewareBase.InvokeAsync(HttpContext context) at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.<>c__DisplayClass19_0.<<UseCancellation>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)I am guessing this new error is caused when the method signature itself changes in some way, such that the invocation reference is messed up..? Because adding new methods to the Query/Mutation classes also fails (it simply does not pick them up).
However, editing the contents of the methods seems to hot reload successfully, and when I run into one of the above limitations it only affects the modified/added method, not the rest of the server...
... so this at least prevents my server from becoming totally unresponsive to any request.
- addedArea: Type SystemIssue is related to the Type SystemIssue is related to the Type System
on Feb 19, 2026 - added 2 commits that reference this issue
on Feb 27, 2026


Is there an existing issue for this?
Product
Hot Chocolate
Describe the bug
I never before had any problems with
dotnet watch runand Hot Chocolate. Now, each time I save any file, the entire server needs to be restarted because the HotChocolate type inspector "has already been marked as initialized" (see logs).This is also a relatively new project, which was created fresh with the new Blazor "Web App" template. It is 100% reproducible in this context, as well as in a new template app.
Steps to reproduce
dotnet watch runRelevant log output
Additional Context?
My data type inspector is very simple:
Version
14.0.0-r7