You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <summary>/// You may have some primary information about this interface./// </summary>publicinterfaceITestInterface{/// <summary>/// Method documentation./// </summary>voidMethod();}///<inheritdoc cref="ITestInterface"/>publicclassTestClass:ITestInterface{publicvoidMethod(){{}
Method in TestClass will inherit the documentation also or do I have to add another <nheritdoc /> in Method as well?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 04441bbc-7e98-d6df-2c5a-20e816d79dc7
Version Independent ID: ba155807-a2b0-8982-abe7-fac1e2b51a7d
Hi @mikadumont, Can someone help with my question above please. Based on documentation adding <inheritdoc /> on class level should be sufficient, and it is indeed sufficient. But warning CS1591 keeps popping up in the IDE for the underlying methods. Does the analyser have to be updated also? Thanks
Based on documentation adding <inheritdoc /> on class level should be sufficient, and it is indeed sufficient ...
The <inheritdoc/> at class level is not necessary for (and is ignored by) methods. The method receives default inherited documentation because it implements an interface member.
But warning CS1591 keeps popping up in the IDE for the underlying methods.
This was covered by a comment above. We have no control over this. #17326 (comment)
I'm not sure where that note came from, but as the implementer of <inheritdoc/> I'm fairly confident that it is not necessary. If that limitation does somehow exist, it would be part of the documentation pipeline and not part of Roslyn's handling of the feature.
Also, the statement is not technically wrong, it's just misleading since it's easy to interpret a statement like that as implying the inverse is true.
I'm not sure if I correctly understand your last comment, @sharwell ...
What is "that limitation"?
Well in the end it seems to necessary to decorate each and every member with <inheritdoc/>. When it's only done at class level, VS keeps showing the warnings... Too bad it doesn't work at class level 😐
Activity
BillWagner commentedon Mar 4, 2020
/cc @mikadumont
Can you provide the answer? Then, we can get this doc updated.
mikadumont commentedon Mar 4, 2020
The method in TestClass will inherit the documentation also and dont need to add another inheritdoc tag.
JuanZamudioGBM commentedon Mar 4, 2020
@mikadumont In that case there will be any changes in CS1591?
Right now if I remove the documentation from the method I get a warning,
mikadumont commentedon Mar 4, 2020
Adding @sharwell
sharwell commentedon Mar 4, 2020
The CS1591 warning would be related to dotnet/roslyn#40325
/cc @dotnet/roslyn-compiler
BillWagner commentedon Mar 5, 2020
Thanks for helping determine the correct update. I've added this to our backlog for when we next update this article.
5 remaining items
BillWagner commentedon May 19, 2021
reopening to address as part of updating the XML section
ozdotnet commentedon Mar 14, 2024
Hi @BillWagner, Is this fixed with #23540? I'm on Visual Studio 2022 17.9.3 and using .NET 6.0 and I still encounter this.
Let's say I have an interface:
And it's implementation:
Adding
/// <inheritdoc />at class level should be enough (also based on this documentation: Recommended XML documentation tags for a class and its members - C# | Microsoft Learn. But I'm still getting the CS1591 warning for the method. Am I doing something wrong?ozdotnet commentedon Apr 2, 2024
Hi @mikadumont, Can someone help with my question above please. Based on documentation adding
<inheritdoc />on class level should be sufficient, and it is indeed sufficient. But warning CS1591 keeps popping up in the IDE for the underlying methods. Does the analyser have to be updated also? Thankssharwell commentedon Apr 2, 2024
The
<inheritdoc/>at class level is not necessary for (and is ignored by) methods. The method receives default inherited documentation because it implements an interface member.This was covered by a comment above. We have no control over this.
#17326 (comment)
In projects I own and maintain, I generally disable three diagnostics to avoid noise:
https://github.com/dotnet/roslyn-analyzers/blob/332dd9ab9ec226d410cc4f42f7ebe24d4fdeb117/Directory.Build.props#L34-L46
ozdotnet commentedon Apr 3, 2024
Thanks for your answer.
Just one remark:
This contradicts with what I read on this page: Recommended XML documentation tags for a class and its members - C# | Microsoft Learn:
sharwell commentedon Apr 4, 2024
I'm not sure where that note came from, but as the implementer of
<inheritdoc/>I'm fairly confident that it is not necessary. If that limitation does somehow exist, it would be part of the documentation pipeline and not part of Roslyn's handling of the feature.Also, the statement is not technically wrong, it's just misleading since it's easy to interpret a statement like that as implying the inverse is true.
khlr commentedon Jan 10, 2025
I'm not sure if I correctly understand your last comment, @sharwell ...
What is "that limitation"?
Well in the end it seems to necessary to decorate each and every member with
<inheritdoc/>. When it's only done at class level, VS keeps showing the warnings... Too bad it doesn't work at class level 😐