Closed dougbenham closed 2 years ago
I could just make some extension method like this instead:
static class OtherRegistryExtensions
{
public static ServiceRegistry AddOther(this ServiceRegistry services)
{
services.AddHttpClient(...);
return services;
}
}
But then we aren't using the child ServiceRegistry logic anymore and instead are just continuing to work with the primary ServiceRegistry. What are the benefits of using child ServiceRegistries?
@dougbenham How is logging getting added twice? Is AddHttpClient() quietly doing a second AddLogging() somehow? I'm not following exactly why this would be a Lamar error.
@dougbenham How is logging getting added twice? Is AddHttpClient() quietly doing a second AddLogging() somehow? I'm not following exactly why this would be a Lamar error.
Yes you can see the source here:
And then in Lamar, you can see how it just naively appends all of the registrations:
This results in logging being added twice. Anyways I don't see a way around this, it just kinda ruins the .IncludeRegistry(..)
methods for any practical purposes. Forced to work with the primary service registry at all times so that you don't encounter weird issues like this.
Okay. There's nothing that's really actionable here, so I'm closing the issue. Just don't call the AddHttpClient() from an additional Lamar ServiceRegistry is all I can say here.
Registrations around logging end up getting messed up because many things are added twice. Is there a workaround for this?