Closed
Description
Current design
Currently, when binding FromServices
always is called the ServiceProviderServiceExtensions.GetRequiredService
(that throws an InvalidOperationException
when the service is not found)
Proposed Change
The proposal is following the same approach apply in Minimal APIs, that basically evaluates the default value and nullability context to decide if the parameter is optional or not and call the ServiceProviderServiceExtensions.GetService
instead when the parameter is optional.