Skip to content

Inheritdoc doesn't copy from generic interfaces #1516

@MichaConrad

Description

@MichaConrad

Title

For simple cases, comments get copied just fine from an interface a class implements.
But if the interface is a generic type, e.g.

public interface IInterface<TSomething>

it does not work.

Functional impact

The result is, the documentation summary does not get copied from the interface to the actual implementation

Minimal repro steps

  • create an interface which has a generic type,
  • implement it in a class,
  • document a method of the interface
  • add to the implementation

Expected result

Summary should be copied over to the implementation

Actual result

Nothing shows up in the generated doc for the implemented class.

Further technical details

After digging into the code, the issue is that when you iterate the "Implements" collection, the IDs used are generated slightly differently than the ones compared against (when trying to find the interface's documentation data).

VisitorHelper.GetCommentId(symbol) generates IDs like ClassName´1
but
for the implementation lookup, SpecIdHelper.GetSpecId(symbol, typeGenericParameters, methodGenericParameters); is used, which generates IDs which look like ClassName{{T}}

That's why context.Members.TryGetValue right here never returns anything.

Hope that makes sense

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet: xml-commentXML comment for .NET API reference docs

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions