OptionalvalidateWhen true, resolving a Scoped service
from the root provider (outside of a scope) throws an error. This helps
catch accidental singleton captures of scoped services.
Recommended for development. Matches .NET's ValidateScopes behaviour.
Options for building a ServiceProvider from a ServiceCollection.
See
ServiceCollection.buildServiceProvider