-
-
Notifications
You must be signed in to change notification settings - Fork 798
Open
Milestone
Description
Product
Hot Chocolate
Version
15.1.8
Link to minimal reproduction
Steps to reproduce
I have this:
public sealed class MemoizedInScopeAttribute() : ServiceAttribute(ServiceKey)
{
public const string ServiceKey = "MEMOIZED";
}
public sealed class UserByUserIdDataLoader(
IBatchScheduler batchScheduler,
DataLoaderOptions options,
[MemoizedInScope] IViewStore<UserView, UserId> viewStore
) : BatchDataLoader<UserId, User>(
batchScheduler,
options
)
{
protected override async Task<IReadOnlyDictionary<UserId, User>> LoadBatchAsync(
IReadOnlyList<UserId> ids,
CancellationToken ct
)
{
var result = await viewStore.MultiGet(ids, ct);
return result.ToDictionary(e => e.Payload.Id, User.From);
}
}
What is expected?
Should work.
What is actually happening?
Exception:
System.InvalidOperationException: This service provider doesn't support keyed services.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetKeyedService(IServiceProvider provider, Type type, Object serviceKey)
at lambda_method3(Closure, IServiceProvider, Object[])
at GreenDonut.DependencyInjection.DataLoaderRegistration.<>c__DisplayClass2_0.<.ctor>b__0(IServiceProvider sp)
at GreenDonut.DependencyInjection.DataLoaderRegistration.CreateDataLoader(IServiceProvider services)
at HotChocolate.Fetching.ExecutionDataLoaderScope.CreateDataLoader[T]()
at HotChocolate.Fetching.ExecutionDataLoaderScope.<GetDataLoader>b__5_0[T](String _)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at HotChocolate.Fetching.ExecutionDataLoaderScope.GetDataLoader[T]()
at HotChocolate.Types.DataLoaderResolverContextExtensions.DataLoader[T](IResolverContext context)
at lambda_method19(Closure, IResolverContext)
at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)
Relevant log output
Additional context
No response
fleed and owieth