Skip to content

Bugfix invalid inheritdoc - #4

Open
marc2911 wants to merge 2 commits into
ChristianSauer:masterfrom
marc2911:bugfix/fix-invalid-inheritdoc
Open

Bugfix invalid inheritdoc#4
marc2911 wants to merge 2 commits into
ChristianSauer:masterfrom
marc2911:bugfix/fix-invalid-inheritdoc

Conversation

@marc2911

@marc2911 marc2911 commented Aug 22, 2026

Copy link
Copy Markdown

Resolves codecentric#94

1. fix doc comment rendering inside IDE

to recap that issue: basically, a method:

public List<string> Method((Class1, Class2) param) {}

generated a compiler warning about an incorrect cref attribute syntax and also any existing doc comments on that method were not rendered

  • this PR fixes that
  • we now use the native Roselyn symbol syntax directly instead of that original hack solution
  • left the old path as fallback
  • Method comments with tuple parameters are now correctly rendered!
private static string InheritDoc(ISymbol source)
{
    var declarationId = DocumentationCommentId.CreateDeclarationId(source);
    if (!string.IsNullOrWhiteSpace(declarationId))
        return $"/// <inheritdoc cref=\"{declarationId}\" />";

    // old probably hacky fallback ...
    // we use inherit doc because that should be able to fetch documentation from base classes.
    return $"/// <inheritdoc cref=\"{source.ToDisplayString().Replace('<', '{').Replace('>', '}').Replace("params ", "")}\" />";
}
  • this also means that all test file snapshots were updated

if you look at for example:
image
we basically now use the canonical symbol representations the compiler uses. those start with a prefix for example M: (Method) and also write return types differently.

=> ultimately this just means that our doc comments should now correctly reference their member and result in correct rendering in any circumstance

2. also updated Example Project to dotnet 10

@marc2911
marc2911 marked this pull request as ready for review August 22, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc comment errors with tuple method parameters

1 participant