Suppress CS1591 warnings for PublicTopLevelProgram.Generated.g.cs by benhopkinstech · Pull Request #60727 · dotnet/aspnetcore (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem a bit of a workaround and the analyzer ASP0027 doesn't pick this up for removal when it is within a user-defined namespace.

I don't think it is correct the user defining a namespace in this way and putting the Program within it but it has obviously worked for them prior to the auto generation logic.

The logic in PublicTopLevelProgramGenerator.cs prior to my change only fails on the DoesNotGeneratesSource_IfProgramIsAlreadyPublic and DoesNotGeneratesSource_IfProgramDeclaresExplicitInternalAccess namespace version of the tests, the rest of the namespace tests I have added passed successfully.

If we can agree on what this should be doing in this minimal API scenario where the user has defined a namespace I can adjust the logic and tests accordingly.