Skip to content

[GeneratedComInterface] in CCW-only mode produces CA2256 warning #90922

Closed
@Sergio0694

Description

@Sergio0694

Description

When using [GeneratedComInterface] with ComInterfaceOptions.ManagedObjectWrapper, the generator emits an empty interface declaration with [DynamicInterfaceCastableImplementation], which then produces a warning:

Reproduction Steps

[Guid("7448E99B-0904-4B6A-9CC2-51DD9A71032A")]
[GeneratedComInterface(Options = ComInterfaceOptions.ManagedObjectWrapper)]
public partial interface IFoo
{
    void Foo();
}

Expected behavior

No build warnings or errors.

Actual behavior

"Microsoft.Interop.ComInterfaceGenerator\IFoo.cs(12,31,12,54): warning CA2256: Type 'InterfaceImplementation' has the 'DynamicInterfaceCastableImplementationAttribute' applied to it but does not provide an implementation of all interface members defined in inherited interfaces (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2256)"

Regression?

No, it's a new feature.

Configuration

  • VS 17.8 Preview 1
  • .NET 8.0.100-rc.2.23421.16
  • Roslyn 4.8.0-1.23377.4 (692d17e9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions