Can only set applicationScopedServiceProvider once
See original GitHub issueVersion 3.1.0
Since 3.1.0, our web applications that use Autofac have been experiencing this error:
Can only set applicationScopedServiceProvider once
I can try and create a repro solution if needed, but just wanted to check first to see whether there is anything obvious I can do to resolve the issue? When debugging into the symbols, both the _applicationScopedServiceProvider and the serviceProvider passed in are instances of AutofacServiceProvider but they must be different because it’s passing the != check.
Version 3.0.0 does not have this issue. Our micro-services projects (that don’t use Autofac) don’t have this issue.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ApplicationServices resolves a different scoped instance in ...
ApplicationServices and not realizing that it is application scoped (global), instead of being scoped to HTTP request, by default, ASP.NET Core ...
Read more >Using Contexts and Dependency Injection for the Java EE ...
The CDI specification defines a set of services for using injection to specify dependencies in an application. CDI provides contextual life cycle management ......
Read more >Oracle REST Data Services Java API Reference
Providers can have one of two life-cycles: @ApplicationScoped - instantiated when the ORDS is started by an application server, destroyed when the application ......
Read more >Using HostBuilder, ServiceProvider and Dependency Injection ...
First of all, after creating a .NET Core Windows Forms application, we need to add the NuGet package Microsoft.Extensions.Hosting to the project ...
Read more >aries-cdi/faq.md at master
The @Service annotation on the bean type may specify a set of types as an argument of the annotation. ... @ApplicationScoped can only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I just released a new version on NuGet, can you try using that version and see if it solves your issue? https://www.nuget.org/packages/EntityFrameworkCore.Triggered/3.2.0-preview.3 (Should appear any minute from now)
This appears to be due to the combination of EFC.Triggered and Autofac. I’ve created a repro here.
3.0.0 issue with MediatR On 3.0.0, we have an intermittent issue with the service provider being disposed before MediatR can spawn a notification handler from it.
Repro:
https://localhost:5001/api/course/add- works3.1.0 issue Bump to 3.1.0 and above issue is fixed, but only when Autofac isn’t involved.
Introduce Autofac and 3.1.0, and we get the issue Anth report here.
To repro:
https://localhost:5001/api/course/add- instant failurePath forward Options:
Keen to hear your thoughts @koenbeuk now that you could reproduce it and have a look.