[RegisterServices] with IHostApplicationBuilder does not generate registration code and reports INJ0001
Description
[RegisterServices] appears to support IHostApplicationBuilder according to the documentation, but using it does not generate the expected registration code.
For example:
using Microsoft.Extensions.Hosting;
[RegisterServices]
public static void Register(IHostApplicationBuilder builder)
{
builder.Configuration.AddJsonFile("xxx.json");
}
The source generator does not generate the corresponding IHostApplicationBuilder registration.
Instead, the following diagnostic is reported:
INJ0001: Method 'Register' marked with [RegisterServices] must have IServiceCollection as its first parameter
Environment
Injectio: 6.2.0
Target framework: net10.0
Microsoft.Extensions.Hosting.Abstractions: 10.x
Microsoft.Extensions.DependencyInjection / Hosting ecosystem
Expected behavior
According to the Injectio documentation, IHostApplicationBuilder should be supported as the first parameter of a [RegisterServices] method, for example:
[RegisterServices]
public static void Register(IHostApplicationBuilder builder)
{
builder.Configuration.AddJsonFile("xxx.json");
}
The generator should recognize this method and generate the corresponding IHostApplicationBuilder extension/registration code.
Actual behavior
The method is rejected with:
INJ0001: Method 'Register' marked with [RegisterServices] must have IServiceCollection as its first parameter
No corresponding generated code for IHostApplicationBuilder is produced.
Additional information
The same [RegisterServices] mechanism works correctly when using IServiceCollection:
[RegisterServices]
public static void Register(IServiceCollection services)
{
// works as expected
}
Is IHostApplicationBuilder actually supported by Injectio 6.2.0 for [RegisterServices] methods, or is there an additional configuration/reference required to enable this behavior?
[RegisterServices] with IHostApplicationBuilder does not generate registration code and reports INJ0001
Description
[RegisterServices] appears to support IHostApplicationBuilder according to the documentation, but using it does not generate the expected registration code.
For example:
The source generator does not generate the corresponding IHostApplicationBuilder registration.
Instead, the following diagnostic is reported:
Expected behavior
According to the Injectio documentation, IHostApplicationBuilder should be supported as the first parameter of a [RegisterServices] method, for example:
The generator should recognize this method and generate the corresponding IHostApplicationBuilder extension/registration code.
Actual behavior
The method is rejected with:
INJ0001: Method 'Register' marked with [RegisterServices] must have IServiceCollection as its first parameter
No corresponding generated code for IHostApplicationBuilder is produced.
Additional information
The same [RegisterServices] mechanism works correctly when using IServiceCollection:
Is IHostApplicationBuilder actually supported by Injectio 6.2.0 for [RegisterServices] methods, or is there an additional configuration/reference required to enable this behavior?