Skip to content

Microsoft.Interop.ComInterfaceGenerator should suppress warning CS1591 (or should provide a way to do so) #119985

@smourier

Description

@smourier

Description

When enabling documentation generation using MSBuild's <GenerateDocumentationFile> property, there's no way to remove CS1591 warning(s) caused by ComInterfaceGenerator's generated code.

Reproduction Steps

.csproj:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFramework>net9.0</TargetFramework>
		<Nullable>enable</Nullable>
		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
		<GenerateDocumentationFile>True</GenerateDocumentationFile>
	</PropertyGroup>

</Project>

interfaces.cs

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;

[assembly: DisableRuntimeMarshalling]

namespace ComClassLibrary1;

/// <summary>
/// This is my interface.
/// </summary>
[GeneratedComInterface, Guid("27dd3a3d-4c16-485a-a123-7cd8f39c6ef2")]
public partial interface IMyInterface
{
    /// <summary>
    /// This does something.
    /// </summary>
    void DoSomething();
}

/// <summary>
/// This is my other interface.
/// </summary>
[GeneratedComInterface, Guid("1b681178-368a-4d13-8893-66b4673d2ff9")]
public partial interface MyOtherInterface : IMyInterface
{
    /// <summary>
    /// This does something else.
    /// </summary>
    void DoSomethingElse();
}

Expected behavior

No warning should be raised when building this.

Actual behavior

Building this outputs this:

Rebuild started at 12:06...
1>------ Rebuild All started: Project: ComClassLibrary1, Configuration: Debug Any CPU ------
1>E:\smo\work\AllTests1\ComClassLibrary1\obj\Debug\net9.0\Microsoft.Interop.ComInterfaceGenerator\Microsoft.Interop.ComInterfaceGenerator\ComClassLibrary1.MyOtherInterface.cs(102,18,102,29): warning CS1591: Missing XML comment for publicly visible type or member 'MyOtherInterface.DoSomething()'
1>ComClassLibrary1 -> E:\smo\work\AllTests1\ComClassLibrary1\bin\Debug\net9.0\ComClassLibrary1.dll
1>Done building project "ComClassLibrary1.csproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 12:06 and took 00,494 seconds ==========

Regression?

I don't think so

Known Workarounds

I don't see any (note: globally removing the warning would be a nonsense)

Configuration

Visual Studio 17.14.15, dotnet 9.0.9

Other information

Other warnings are already removed in a harcoded way, as show here https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs#L198

Maybe it would be better to re-use possible documentation snippets into generated code, I guess it's more work.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions