Skip to content

Access to ImplementationFactory Throws if KeyedService #210

@Mike-E-angelo

Description

@Mike-E-angelo

Greetings out there @seesharper I hope this finds you well. 👋

There appears to be an issue when LightInject creates a provider that has keyed services. It's a little tricky because this appears to be a framework issue that is addressed in .NET9 and has a fix on the way with .NET8. However, it is unclear how long it will be before this is released so I am reporting it here to see if it might be possible to address it sooner. 😁

I originally reported this issue here:
dotnet/extensions#5376

(You can follow the steps to reproduce)

The fix there worked, but upon incorporating Redis support in my Aspire application, I ran into it again with the Aspire hosting assembly Aspire.StackExchange.Redis.OutputCaching. As I am getting the sense there will be more assemblies on the way before the .NET8 fix I am reaching out here to see if we can get a hot/quick fix even if it's on a preview build.

The issue appears to happen here:
https://github.com/seesharper/LightInject.Microsoft.DependencyInjection/blob/master/src/LightInject.Microsoft.DependencyInjection/LightInject.Microsoft.DependencyInjection.cs#L146

Access to ImplementationFactory when the service descriptor has a key will result in an exception.

Please let me know if you have any questions around this and I will assist. 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions