Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

Improved XML documentation support in ReSharper and Rider

Having code with XML documentation is great, as it allows generating nice API documentation and provides useful help while writing code:

XML documentation class and parameter info

ReSharper 2017.2 and Rider 2017.2 EAP give us more tooling to organize XML documentation across inheritance hierarchies.

When creating a class library that provides XML documentation, we can make use of the <inheritdoc/> element to inherit documentation from a base class or an interface. Consider the following code:

/// <inheritdoc />
public class TenantAwareCustomerRepository
    : ITenantAware, IRepository<Customer>
{
}

Should documentation be inherited from ITenantAware or IRepository<T> in this case? If we leave our code like this, we’ll not get any documentation at all. We’ll have to specify which base class we want to inherit documentation from, using the cref attribute. A new inspection (and quick-fix) will help us provide proper API documentation to the users of our library. Note that ReSharper and Rider provide us with code completion for possible types to reference when we invoke Smart Completion (Ctrl+Alt+Space).
Invalid use of inheritdoc

Another code inspection will warn us when a derived class overrides documentation of its base class, and offers to add <inheritdoc/> to the XML documentation:
Suggest adding inheritdoc element

Download ReSharper Ultimate 2017.2 now or check out Rider 2017.2 EAP! We’d love to hear your thoughts.

image description