dotnet / dotnet/runtime

[GeneratedComInterface] Generates ambiguous ABI_ overloads when interface methods differ only in parameter types

Open
#120,410 5 comments 0 reactions 0 assignees View on GitHub
area-Interop-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

I discovered this when trying to use [GeneratedComInterface] on IDWriteGdiInterop1, which inexplicably has two GetFontSignature which differ only in a pointer-parameter type. https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nn-dwrite_3-idwritegdiinterop1

### Reproduction Steps

```c#
[Guid("00000000-0000-0000-0000-000000000001"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface]
public partial interface IBase
{
}

[Guid("00000000-0000-0000-0000-000000000002"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface]
public partial interface IDerived : IBase
{
}

[Guid("00000000-0000-0000-0000-000000000003"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface]
public partial interface IRepro
{
void Test(IDerived foo);
void Test(IBase foo);
}
```

### Expected behavior

Compiles & works.

### Actual behavior

Compile error:
> Microsoft.Interop.ComInterfaceGenerator\Repro.IRepro.cs(93,25,93,33): error CS0111: Type 'InterfaceImplementation' already defines a member called 'ABI_Test' with the same parameter types

### Regression?

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.