dotnet / dotnet/aspnetcore

Question: Custom Service Provider Not Used Everywhere

Open
#58,400 5 comments 0 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

So, I register my own IServiceProviderFactory using WebApplicationBuilder.Host.UseServiceProviderFactory, from which I return a custom IServiceProvider implementation. I see that it is called, and *appears* to work, however, when I try to inject some service into my controller, I see that it does not come from my IServiceProvider, but instead from an ServiceProviderEngineScope. Why is this? Shouldn't the registered factory be used for creating the global IServiceProvider?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.