Closed
Description
Description
Service Provider cannot resolve transient service from the Root scope if the ValidateOnBuild
option is enabled.
Reproduction Steps
interface IBar {}
class Bar1 : IBar {}
class Bar2 : IBar {}
services.AddScoped<IBar, Bar1>();
services.AddTransient<IBar, Bar2>();
var sp = services.BuildServiceProvider(new ServiceProviderOptions { ValidateScopes = true, ValidateOnBuild = true });
Expected behavior
Debug.Assert(sp.GetService<IBar>() is Bar2)
Actual behavior
Thrown Exception
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response