Skip to content

Wrong type resolving on version 1.6.0 and 1.6.1 #597

Description

@yevgenchepurko

Dear, Bernhard Richter.

Thank you for your work on LightInject.Microsoft.Hosting and other components.
Here is an issue that we've encountered with LightInject.Microsoft.Hosting.

With version 1.5.3

having setup

serviceRegistry.RegisterScoped<IA>(f => new A1());
serviceRegistry.RegisterScoped<IA>(f => new A3(), nameof(A3));
serviceRegistry.RegisterScoped<IA>(f => new A2(), nameof(A2));

the resolution

host.Services.GetService<IA>();

Resolved to Type A1 - unnamed instance.
But with latest version 1.6.1 it resolves into A3, it started with version 1.6.0

Please find attached test project demonstrating the issue.
LightInjectMicrosoftHostingTest.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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