Open xakep139 opened 8 months ago
Registering any service should register all of its required dependencies. If some of those are conditionally required then there should be separate extensions for those scenarios where they are required.
Regarding redaction, my suggestion would be to register NullRedactorProvider
if IRedactorProvider
isn't registered in the DI yet. But we need to ensure that subsequent call to AddRedaction()
replaces previous registration.
Currently, if I use
Microsoft.Extensions.Http.Diagnostics
package, it's assumed that I've already referencedMicrosoft.Extensions.Compliance.Redaction
package and registeredAddRedaction()
in theIServiceCollection
.For LatencyContext feature it's also required to call
AddLatencyContext()
.If any of these actions weren't done, then a user gets an exception:
For LatencyContext it's at the same level of being counter-intuitive on how to resolve the issue:
We need to throw at least some human-understandable exception that explains what requirements/missing dependencies need to be registered.
This is slightly related to #4560