Skip to content

GenAPI incorrectly generates collection-based interface implementation #31570

Closed
@mthalman

Description

@mthalman

When targeting System.Collections.Immutable.1.7.1, GenAPI generates a class implementation which doesn't implement the interface that its member explicitly attempts to implement.

This illustrates the issue:

public sealed partial class ImmutableHashSet<T> : IEnumerable, ICollection
{
    bool Generic.ICollection<T>.IsReadOnly { get { throw null; } }
}

This results in a build error:

error CS0540: 'ImmutableHashSet<T>.ICollection<T>.IsReadOnly': containing type does not implement interface 'ICollection<T>'

You can see that the generated class doesn't implement any of the generic interfaces that it should:

public sealed class ImmutableHashSet<T> : IImmutableSet<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IHashKeyCollection<T>, ICollection<T>, ISet<T>, ICollection, IStrongEnumerable<T, ImmutableHashSet<T>.Enumerator>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions