Fix unguarded calls to ServiceDescriptor.ImplementationType for keyed services (#16604)
* Update integration test base class to verify that calls to ServiceDescriptor.ImplementationType are guarded for keyed services * Fix unguarded calls to ServiceDescriptor.ImplementationType for keyed services
This commit is contained in:
@@ -136,6 +136,12 @@ public abstract class UmbracoIntegrationTest : UmbracoIntegrationTestBase
|
||||
|
||||
services.AddLogger(webHostEnvironment, Configuration);
|
||||
|
||||
// Register a keyed service to verify that all calls to ServiceDescriptor.ImplementationType
|
||||
// are guarded by checking IsKeyedService first.
|
||||
// Failure to check this when accessing a keyed service descriptor's ImplementationType property
|
||||
// throws a InvalidOperationException.
|
||||
services.AddKeyedSingleton<object>("key");
|
||||
|
||||
// Add it!
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
var typeLoader = services.AddTypeLoader(
|
||||
|
||||
Reference in New Issue
Block a user