You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the Microsoft.Extensions.DependencyInjection integration, when registering an existing object instance as a singleton, it's dispose method is also invoked when the IServiceProvider is disposed although the instance has been created by the user and not by the container itself. The Microsoft default implementation does not dispose instances that have been registered this way but it doesn't seem to be a part of the "specs".
repro:
varserviceCollection=new ServiceCollection();
serviceCollection.AddSingleton(new MySingleton());varserviceProvider= serviceCollection.CreateLightInjectServiceProvider(new ContainerOptions().WithMicrosoftSettings());varsingleton= serviceProvider .GetService<MySingleton>();(sp as IDisposable).Dispose();// Dispose of MySingleton is called
Are there any plans to align the disposal behavior with Microsoft's default container implementation?
The text was updated successfully, but these errors were encountered:
Using the Microsoft.Extensions.DependencyInjection integration, when registering an existing object instance as a singleton, it's dispose method is also invoked when the
IServiceProvider
is disposed although the instance has been created by the user and not by the container itself. The Microsoft default implementation does not dispose instances that have been registered this way but it doesn't seem to be a part of the "specs".repro:
Are there any plans to align the disposal behavior with Microsoft's default container implementation?
The text was updated successfully, but these errors were encountered: