Skip to content

Documentation comments on partial methods #5193

@RikkiGibson

Description

@RikkiGibson

To date, it appears that doc comments on partial method definitions are ignored. The compiler will give diagnostics when the doc comment is invalid, but it won't include the comments in the documentation file, and the doc comments also appear to be absent from Quick Info. This introduces some painful scenarios where the user declares a partial definition, includes doc comments, and the partial implementation is provided by a source generator. See dotnet/roslyn#54103.

We intend to address the situation by making it so it's only necessary to provide doc comments on either the partial definition or implementation, not both. If doc comments are present on only one of the two, we use those doc comments on the symbol. If doc comments are present on both definition and implementation, we preserve existing behavior by using the implementation comments and dropping the definition comments.

Also, we add a rule which ensures that a partial method with doc comments and with no implementation is not included in the documentation file. In this scenario, we do still return any documentation on the symbol from public API such as ISymbol.GetDocumentationCommentXml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Proposal QuestionQuestion to be discussed in LDM related to a proposal

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions