// Register Bar service without providing a name:
serviceContainer.Register<Bar>();
// The following code injects Lazy<Bar> but it should fail because there is no service Bar with name "some-name":
Consumer ([Inject("some-name")] Lazy<Bar> lazyBar) {
// this also does not fail:
Console.WriteLine(lazyBar.Value.ToString());
}
Inject attribute is effectively ignored when Lazy<> is used. According to the source code service name is not used when Lazy<> is requested.
I'm trying to use named services to create Lazy<HttpClient> automatically via RegisterFallback but this bug prevents RegisterFallback from running.
Injectattribute is effectively ignored whenLazy<>is used. According to the source code service name is not used whenLazy<>is requested.I'm trying to use named services to create
Lazy<HttpClient>automatically viaRegisterFallbackbut this bug preventsRegisterFallbackfrom running.