Use a separate container and test fails with an exception:
Message:
System.InvalidOperationException : No service for type 'Microsoft.Extensions.DependencyInjection.IServiceScopeFactory' has been registered.
Stack Trace:
ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
ServiceProviderServiceExtensions.CreateScope(IServiceProvider provider)
MEDIContainerTests.CanCreateScopeUsingExtensionMethod() line 29
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
If there is a call like:
c.GetService<IServiceScopeFactory>()
IServiceScopeFactory
type is registered inRootCallSites
and an entry is generated for it: https://github.com/pakrym/jab/blob/aab09936addd9a82dc483efb73290abf03bb0645/src/Jab/ContainerGenerator.cs#L333Use a separate container and test fails with an exception: