Skip to content

Conversation

@adamsitnik
Copy link

@adamsitnik adamsitnik commented May 9, 2025

While working on microsoft/semantic-kernel#11155 I've run into a bug: <auto-generated/> is not respected by CS1591.

The issue is known to the compiler team: dotnet/roslyn#41171

Most of the users workaround it by adding a dedicated pragma warning disable like here in dotnet/runtime:

https://github.com/dotnet/runtime/blob/d23f2514eceb39c7bb85bf392f3742c301290dac/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Baselines/UsingInterfaceAsPropertyTypeForLengthAttributesTests.netcore.g.cs#L2-L5

I decided to simply add the XML doc comments (which is nice anyway as users are supposed to consume it). This is what S.T.J did in dotnet/runtime#72761 as well

Standalone repro:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
    <EnableNETAnalyzers>true</EnableNETAnalyzers>
    <AnalysisMode>AllEnabledByDefault</AnalysisMode>
    <AnalysisLevel>latest</AnalysisLevel>
    <NoWarn></NoWarn> <!-- Ensure CS1591 is not suppressed -->
    <WarningsAsErrors>CS1591</WarningsAsErrors> <!-- Treat missing XML docs as warnings or errors -->
    <GenerateDocumentationFile>true</GenerateDocumentationFile> <!-- Generate XML documentation -->
  </PropertyGroup>
</Project>
// <auto-generated/>

using System.Data.Common;

namespace AutoGeneratedWarning
{
    public static class SqliteVectorExtensions
    {
        public static void LoadVector(this DbConnection connection)
        {
            _ = connection;
        }
    }
}

@jeffhandley jeffhandley merged commit ee3734e into jeffhandley:release/0.0.1-alpha.19.nuget May 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants