Skip to content

8.2.0+ Breaks Code While 8.1.0 Does Not: This service descriptor is keyed. Your service provider may not support keyed services. #5376

@Mike-E-angelo

Description

@Mike-E-angelo

Description

There appears to be an issue with using 8.2.0+ of this library as discussed here:
JasperFx/lamar#395

Reverting back to 8.1.0 does indeed fix the issue.

Reporting here to track and to hopefully resolve with fix.

Reproduction Steps

  1. Run this test.
  2. Note the thrown exception:
  3. Revert back to 8.1.0
  4. Note successful passing test with no exception thrown

Expected behavior

No Exception thrown.

Actual behavior

Exception thrown:

System.InvalidOperationException
This service descriptor is keyed. Your service provider may not support keyed services.
   at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ThrowKeyedDescriptor()
   at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.get_ImplementationFactory()
   at LightInject.Microsoft.DependencyInjection.DependencyInjectionContainerExtensions.CreateServiceRegistration(ServiceDescriptor serviceDescriptor, Scope rootScope)
   at LightInject.Microsoft.DependencyInjection.DependencyInjectionContainerExtensions.<>c__DisplayClass1_0.<RegisterServices>b__0(ServiceDescriptor d)
   at System.Linq.Enumerable.SelectIListIterator`2.Fill(IList`1 source, Span`1 results, Func`2 func)
   at System.Linq.Enumerable.SelectIListIterator`2.ToList()
   at LightInject.Microsoft.DependencyInjection.DependencyInjectionContainerExtensions.RegisterServices(IServiceContainer container, Scope rootScope, IServiceCollection serviceCollection)
   at LightInject.Microsoft.DependencyInjection.DependencyInjectionContainerExtensions.CreateServiceProvider(IServiceContainer container, IServiceCollection serviceCollection)
   at LightInject.Microsoft.DependencyInjection.LightInjectServiceProviderFactory.CreateServiceProvider(IServiceContainer containerBuilder)
   at DragonSpark.Composition.Construction.Factory.CreateServiceProvider(IServiceContainer containerBuilder) in D:\Quikzer\Framework\DragonSpark.Composition\Construction\Factory.cs:line 17
   at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
   at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
   at DragonSpark.Application.Hosting.Server.Run.WebApplicationHostBuilder.Build() in D:\Quikzer\Framework\DragonSpark.Application.Hosting.Server\Run\WebApplicationHostBuilder.cs:line 34
   at DragonSpark.Application.Compose.InitializedAwareHostBuilder.Build() in D:\Quikzer\Framework\DragonSpark.Application\Compose\InitializedAwareHostBuilder.cs:line 29
   at DragonSpark.Application.Run.RunApplication.Get(String[] parameter) in D:\Quikzer\Framework\DragonSpark.Application\Run\RunApplication.cs:line 22
   at DragonSpark.Application.Testing.Run.ConfigureNewTests.Verify() in D:\Quikzer\Framework\DragonSpark.Application.Testing\Run\ConfigureNewTests.cs:line 23
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Regression?

8.1.0

Known Workarounds

Pin to 8.1.0

Configuration

.NET8

Other information

Thank you very much for all your efforts out there 🙏

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions