BRO1604: Property summary documentation should match accessors¶
A property's summary begins with the words its accessors call for: Gets or sets, Gets or Sets (with an
init accessor: Gets or initializes, Gets or sets or just Gets, and Initializes), followed by a value indicating whether
for a bool. Replaces StyleCop SA1623.
Example¶
Before¶
public class Order
{
/// <summary>The order number.</summary>
public string Number { get; set; }
/// <summary>Gets or sets the total.</summary>
public decimal Total { get; }
/// <summary>Whether the order is paid.</summary>
public bool IsPaid { get; set; }
}
After¶
public class Order
{
/// <summary>Gets or sets the order number.</summary>
public string Number { get; set; }
/// <summary>Gets the total.</summary>
public decimal Total { get; }
/// <summary>Gets or sets a value indicating whether the order is paid.</summary>
public bool IsPaid { get; set; }
}
Why¶
The summary then says at a glance what callers can do with the property, and it matches the .NET documentation.
How the fix works¶
The words are compared ignoring case: Gets or Sets the key is right, and a wrong gets the count on a
property with a setter becomes Gets or sets the count. A wrong prefix is replaced, or the right one is added in front, with the next word's first letter lowered
(The order number becomes Gets or sets the order number; an acronym like URL keeps its capitals). For a
bool, a summary that starts with Whether, Indicates whether or Gets whether has that replaced too (only bool:
a bool? property's Gets whether stays). The words
are only added in front of a noun phrase: a summary that starts with an article (The, A, An) or a lower-case
word. The fix doesn't rephrase anything else.
Which words: Gets or sets for a getter and a setter other code can use, Gets for a getter only (a private or
internal setter doesn't count, see BRO1605; a protected one does), Sets for a setter only (a private
or internal getter doesn't count either: { private get; set; } says Sets). An init
accessor counts like a setter: Gets or initializes (or Gets or sets, or just Gets) for { get; init; }, Initializes when it's
the only accessor other code can use. Gets or initializes and Initializes are wrong prefixes elsewhere and get
replaced (Gets or initializes the value. on { get; set; } becomes Gets or sets the value.).
This rule reads documentation as XML, which needs <GenerateDocumentationFile>true</GenerateDocumentationFile>.
Configuration¶
[*.cs]
# stylecop (default): as described here.
# stylesharp: StyleSharp's SST1623 (bro migrate writes it for a StyleSharp repository; also BRO1605-BRO1607).
stylebro_summary_wording = stylecop
With stylesharp a getter counts whatever its modifier ({ private get; set; } says Gets or sets), any modifier on
the setter makes it restricted (BRO1605, protected too), an init accessor without one reads as Gets,
and a summary that starts with the words and a space is right: Gets or sets the count. on { get; } starts with
Gets, so it isn't reported.
Not reported¶
- Indexers.
- Summaries that start with an element (
<see cref="..."/>) or whose first words wrap to the next line. - Summaries without one of the prefixes that don't start like a noun phrase, i.e. with anything but an article
(
The,A,An) or a lower-case word:This is the hash,Not used,Device id of the user,If true, the command text is inspected,Returns the name,Is it closed. Words in front of these wouldn't make a sentence (Gets or sets this is the hash), and there's no fix that surely does, so there's no diagnostic either; rephrase them by hand. Also not reported: a lower-case condition or verb (if,when,whenever,unless,while,whether(not on abool, where it's replaced),true,false,returns,specifies,indicates,determines,contains,controls,defines,represents,provides,allows,enables,describes,stores,holds,is,has,can). - A
boolsummary that starts with an article (The tokenizer predicted a multi-word token here.): it's often a clause, and neitherGets or sets the tokenizer predicted ...norGets or sets a value indicating whether the open statemakes a sentence of every one (owner's decision 2026-10-12, issue #132). Summaries that start withWhetherare still fixed.