For example, correct configuration:
o.HttpClientFactory(this.SomeFlag ? () => new HttpClient() : () => StaticClient)
Incorrect configuration that will result in a different ServiceProvider key for each context instance:
o.HttpClientFactory(() => this.SomeFlag ? new HttpClient() : StaticClient)
This also applies to WebProxy, UseMemoryCache, DefaultAzureCredential and the new model interceptor.
However, this isn't an issue if the specified lifetime for options is Singleton