Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Implementing Interface via Intellisense create methods with <inheritdoc /> automatically #53558

Closed
vsfeedback opened this issue May 20, 2021 · 5 comments
Labels
Area-IDE Resolution-Duplicate The described behavior is tracked in another issue

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


When using an interface in a class and choosing Implement Interface have it create the method with the XML summary of <inheritdoc /> automatically so that the interfaces documentation is applied without the developer having to do the three forward strokes, undo the automatic text insertion and then add the inheritdoc tag

eg.

public class MyClass : IMyClass
{
    /// <inheritdoc />
    public void MyMethodFromInterface()
    {
         throw new NotImplementedException();
    }
}

Original Comments

Feedback Bot on 5/12/2021, 11:25 PM:

Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. We'll provide an update once the issue has been triaged by the product team.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 20, 2021
@sharwell
Copy link
Member

The <inheritdoc /> element is redundant in this case. Members which implement an interface member inherit documentation by default.

@sharwell
Copy link
Member

Duplicate of #47436

@sharwell sharwell marked this as a duplicate of #47436 May 20, 2021
@sharwell sharwell added Resolution-Duplicate The described behavior is tracked in another issue and removed untriaged Issues and PRs which have not yet been triaged by a lead labels May 20, 2021
@dotMorten
Copy link

@sharwell it's redundant? If I don't put anything there I get this build warning:

warning CS1591: Missing XML comment for publicly visible type or member 'MyClass.MyMethodFromInterface'

Also looking at the generated XML doc, this entire thing is now gone. Also DocFX will complain that doc is missing.

@sharwell
Copy link
Member

sharwell commented Jun 3, 2021

warning CS1591

I would recommend disabling this warning. The compiler does not account for inheritdoc so you'll be prone to false positives with this warning. A tracking issue for the scenario is #42392.

Also looking at the generated XML doc, this entire thing is now gone. Also DocFX will complain that doc is missing.

This is a DocFX bug/limitation. If it hasn't already been updated to account for implicit inheritdoc, it would be good to complete that. Related issues seem to include dotnet/docfx#3699, dotnet/docfx#6995, dotnet/docfx#6366, dotnet/docfx#5909, dotnet/docfx#5996.

@dotMorten
Copy link

I would recommend disabling this warning. The compiler does not account for inheritdoc so you'll be prone to false positives with this warning. A tracking issue for the scenario is #42392.

That's not really an option. We want to generate doc for our code, so disabling it would mean missing out where it is needed, and doing it per-member is A LOT of work. Might be easier to just post-process the entire thing. At least with cref it gets into the generated xml, and docfx does seem to some extent know that the member is coming from an interface, so again a post-process thing there could fix it. I'd just prefer things "just works" :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Resolution-Duplicate The described behavior is tracked in another issue
Projects
None yet
Development

No branches or pull requests

3 participants