New build-time warnings are observed when upgrading from Injectio 5.1.0 to 5.2.0 -- was this an intended change?
Steps to reproduce
> dotnet --version
10.0.203
> dotnet new console
> dotnet package add Injectio --version 5.2.0
> dotnet package add Microsoft.Extensions.DependencyInjection
Edit Program.cs and replace it with:
using Microsoft.Extensions.DependencyInjection;
public interface IRepro {}
[RegisterSingleton(Registration = RegistrationStrategy.Self)]
[RegisterSingleton<Func<Repro>>(Factory = nameof(Factory))]
internal sealed class Repro : IRepro {
internal static Func<Repro> Factory(IServiceProvider provider)
=> provider.GetRequiredService<Repro>;
}
static class Program {
static void Main() {}
}
Run dotnet build and note an unexpected warning is reported:
Program.cs(7,23): warning INJ0007: Type 'global::Repro' does not implement or inherit from service type 'global::System.Func<global::Repro>'
The intent here was to register both the class itself, and a Func<Repro> factory function for lazy consumption, as singletons. The warning is unexpected as the factory appears to be registered correctly (and it works as expected.)
When reverting Injectio back to v5.1.0, no warnings are reported.
Is this a bug/regression in the latest version? If not, how can such use cases be updated to avoid new build-time warnings?
New build-time warnings are observed when upgrading from Injectio 5.1.0 to 5.2.0 -- was this an intended change?
Steps to reproduce
Edit
Program.csand replace it with:Run
dotnet buildand note an unexpected warning is reported:The intent here was to register both the class itself, and a
Func<Repro>factory function for lazy consumption, as singletons. The warning is unexpected as the factory appears to be registered correctly (and it works as expected.)When reverting Injectio back to v5.1.0, no warnings are reported.
Is this a bug/regression in the latest version? If not, how can such use cases be updated to avoid new build-time warnings?