seesharper / LightInject.Microsoft.DependencyInjection

Implements Microsoft.Extensions.DependencyInjection.Abstraction
MIT License
47 stars 13 forks source link

Service registered with ServiceLifetime.Singleton can be created multiple times #63

Open Cpa3y opened 5 years ago

seesharper commented 5 years ago

@Cpa3y Do you have more information on this?

Cpa3y commented 5 years ago

I am using LightInject 5.4.0 in aspnet core 2.2 project. I have added LightInject as described in this instruction https://www.lightinject.net/microsoft.aspnetcore.hosting But my services registered in IServiceCollection. And I have service with expensive controller registered as singletone. So this service's constructor may be called twice (or more) if I request this service for the 1st time and 2nd time within small interval.

I have created small demo project https://github.com/Cpa3y/lightinject-issue-demo

seesharper commented 5 years ago

@Cpa3y Thanks for the information. Looking into it