Reputation: 1
I have been setting up DI using LightInject for a new .NET Core 3.0 project. I followed the guide here: https://www.lightinject.net/microsoft.aspnetcore.hosting/. While running the project, I have encountered this error:
System.InvalidOperationException: Attempt to create a disposable instance without a current scope. at LightInject.PerRequestLifeTime.TrackInstance(Scope scope, IDisposable disposable) at LightInject.PerRequestLifeTime.GetInstance(Func`1 createInstance, Scope scope) at LightInject.ServiceContainer.TryGetInstance(Type serviceType) at LightInject.Microsoft.DependencyInjection.LightInjectServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Routing.Matching.DfaMatcherFactory.CreateMatcher(EndpointDataSource dataSource) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.InitializeCoreAsync()
Did anyone encounter the same issue and found a fix?
Upvotes: 0
Views: 241