AutoRegisterInject icon indicating copy to clipboard operation
AutoRegisterInject copied to clipboard

Generated Extension Methods contribute to build warnings

Open ristogod opened this issue 1 year ago • 1 comments

We've got a project with:

   <PropertyGroup>
      <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>

We rely on warnings to help us find undocumented public methods. When using AutoRegisterInject, we get these build issues

...\AccountSvc\srcs\webs\WebApi\AutoRegisterInject\AutoRegisterInject.Generator\AutoRegisterInject.ServiceCollectionExtension.g.cs(7,21,7,65): warning CS1591: Missing XML comment for publicly visible type or member 'AutoRegisterInjectServiceCollectionExtension'
...\WebApi\AutoRegisterInject\AutoRegisterInject.Generator\AutoRegisterInject.ServiceCollectionExtension.g.cs(9,79,9,117): warning CS1591: Missing XML comment for publicly visible type or member 'AutoRegisterInjectServiceCollectionExtension.AutoRegisterFromAccountWebApi(IServiceCollection)'

I considered attempting to suppress the warnings by first seeing if I couldn't extended the generated code with partial implementations, but the generated code isn't partial.

// <auto-generated>
//     Automatically generated by AutoRegisterInject.
//     Changes made to this file may be lost and may cause undesirable behaviour.
// </auto-generated>
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
public static class AutoRegisterInjectServiceCollectionExtension
{
    public static Microsoft.Extensions.DependencyInjection.IServiceCollection AutoRegisterFromTaylorUFPAccountWebApi(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection)
    {
        return AutoRegister(serviceCollection);
    }

    internal static Microsoft.Extensions.DependencyInjection.IServiceCollection AutoRegister(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection)
    {
        
        return serviceCollection;
    }
}

The generated code could supply xml comments or suppress warnings related to them. I'm unsure which would be the better solution.

ristogod avatar May 06 '24 15:05 ristogod

This will be fixed in a new version by the end of the month.

patrickklaeren avatar May 09 '24 07:05 patrickklaeren