Skip to content

BRO1607: Destructor summary documentation should begin with standard text

A finalizer's summary begins with Finalizes an instance of the <see cref="T"/> class.. Replaces StyleCop SA1643.

Example

Before

public class NativeBuffer
{
    /// <summary>Releases the native memory.</summary>
    ~NativeBuffer()
    {
    }
}

After

public class NativeBuffer
{
    /// <summary>Finalizes an instance of the <see cref="NativeBuffer"/> class. Releases the native memory.</summary>
    ~NativeBuffer()
    {
    }
}

Why

The standard sentence is what the .NET documentation uses for finalizers, and it links to the type.

How the fix works

Like BRO1606: the standard sentence goes first, a near miss of it is replaced, and an empty or whitespace-only summary gets it. This rule reads documentation as XML, which needs <GenerateDocumentationFile>true</GenerateDocumentationFile>.

Compared with StyleCop

Same results as StyleCop, including whitespace-only summaries. StyleCop's fix leaves out the space after the standard sentence.