-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'This service descriptor is keyed. Your service provider may not support keyed services.' #395
Comments
The problem is caused by Microsoft.Extensions.Http.Resilience 8.2.0. As a temporary workaround, you can downgrade to 8.1.0. |
Thanks. I've since updated everything and it has gone away, so not sure where it got fixed as Wolverine is now like 1.18.1 or something. |
I am running into the same. @JasperFx any ideas on the fix here? I can take a stab at it if you point me in the right direction (and it's first time contributor friendly 😄) |
I believe you need to check for "!x.IsKeyedService" in ServiceGraph, when building the closed generics, just before the !x.ImplementationType.IsOpenGeneric() call. The call probably needs to be something like: var closed = services.Where(x => x.ServiceType == serviceType && (x.IsKeyedService
? !x.KeyedImplementationType.IsOpenGeneric()
: !x.ImplementationType.IsOpenGeneric()))
.Select(Instance.For); However, given the way Microsoft implemented these keyed services, I'm not sure this is just an workaround. That's why I didn't submit a PR, I don't fully understand the potential side effects. |
Added a PR anyway, might serve as a starting point. |
Hi all, I found this issue by searching online and I was happy to see this "fix" rather than this being due to something fundamental with my code. FWIW I have created an issue to track here: dotnet/extensions#5376 |
I don't think this is a regression issue on the framework. It was a design decision, IIRC, although it is a breaking change. |
Indeed @psampaio here's a running conversation of the grief: This is fixed in .NET9, and a PR is on the way to address it in .NET8: |
0 You can add all your keyed dependencies in the last as a workaround. services.AddSingleton<INotificationService, NotificationService>(); |
I found #388, which seems related.
I'm using Aspire preview 3 and targeting .net 8.
I get this error at startup:
Here are my dependencies:
The text was updated successfully, but these errors were encountered: