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

/// <inheritdoc /> Does not always display documentation #5996

Closed
Hamsterland opened this issue May 31, 2020 · 1 comment
Closed

/// <inheritdoc /> Does not always display documentation #5996

Hamsterland opened this issue May 31, 2020 · 1 comment
Labels
dotnet: xml-comment XML comment for .NET API reference docs dotnet Generate .NET API reference docs

Comments

@Hamsterland
Copy link

Hamsterland commented May 31, 2020

Operation System: (Windows or Linux or MacOS)
Windows

DocFX Version Used:
2.5.4

Template used: (default or statictoc or contain custom template)
Default

Steps to Reproduce:

  1. Create an interface
  2. Give the interface a method
  3. Add xml documentation to the interface
  4. Create a class that implements the interface
  5. Add the /// <inheritdoc /> tag to the implemented method

Expected Behavior:
The implemented documentation always shows

Actual Behavior:
The implemented documentation does always show. There is no clear indication as to what triggers its showing on infrequent occasions.

https://i.imgur.com/PWMWnDo.png (In class)
https://i.imgur.com/8xzeXuG.png (In interface)

Actual Behavior
First

public interface IInterface {
	/// <summary>
	/// A method
	/// </summary>
	void MyMethod1();
	
	/// <summary>
	/// Another method
	/// </summary>
	void MyMethod2();
}
public class IClass : IInterface {
	/// <inheritdoc />
	void MyMethod1();
	
	/// <inheritdoc />
	void MyMethod2();
}

Implemented documentation does not show for either methods.

Second

public class IClass : IInterface {
	/// <inheritdoc cref="IInterface.MyMethod1"/>
	void MyMethod1();
	
	/// <inheritdoc />
	void MyMethod2();
}

Add explicit reference to interface method in any of the class methods. Implemented documentation for both methods show.

Third
Removing the explicit reference now fixes the issue. Documentation for class shows for all subsequent serves.

@sharwell
Copy link
Member

sharwell commented Jun 3, 2021

📝 Note that for the first example, IClass does not need to explicitly include the <inheritdoc/> element. This element is implicitly included for methods in a class that implement an interface method or override a base class method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet: xml-comment XML comment for .NET API reference docs dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

3 participants