Skip to content

"Internal error in the C# compiler" (CS8751) with nameof operator used on COM interop type indexer #43318

Open

Description

Version Used:

Microsoft Visual Studio Community 2019
Version 16.5.3
VisualStudio.16.Release/16.5.3+30002.166
C# Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
[...]

Steps to Reproduce:

Open the following repro solution in VS 2019 and try to compile it.

Repro.zip

This repro includes a small DLL that contains COM interop types. IDL source and build instructions for that DLL can be found at moq/moq4 (in the tests/Moq.Tests.ComTypes/ directory).

Expected Behavior:

Should successfully compile (as it does in e.g. VS 2017).

Actual Behavior:

Internal error in the C# compiler (CS8751) at nameof(IHasIndexer.Item).

For quick reference, IHasIndexer is a COM interop type defined in IDL as follows (see link above):

[uuid("5ee16909-c4c7-49dc-8808-219078e5d3ba")]
interface IHasIndexer : IUnknown
{
    [propget, bindable, defaultbind] HRESULT Item([in] long index, [out, retval] long *value);
    [propput, bindable, defaultbind] HRESULT Item([in] long index, [in] long value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Area-CompilersBugTenet-ReliabilityCustomer telemetry indicates that the product is failing in a crash/hang/dataloss manner.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions