Skip to content
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

Wrong type resolving on version 1.6.0 and 1.6.1 #597

Open
yevgenchepurko opened this issue Oct 4, 2024 · 0 comments
Open

Wrong type resolving on version 1.6.0 and 1.6.1 #597

yevgenchepurko opened this issue Oct 4, 2024 · 0 comments

Comments

@yevgenchepurko
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant