Skip to content

XmlCrefAttributeSyntax with generic types #235

@sharwell

Description

@sharwell

I tried to create a cref attribute for an element in an XML documentation element using the following code:

TypeSyntax typeSyntax = SyntaxFactory.ParseTypeName("global::System.Lazy<T>");
TypeCrefSyntax cref = SyntaxFactory.TypeCref(typeSyntax);
XmlCrefAttributeSyntax crefAttribute = SyntaxFactory.XmlCrefAttribute(
    SyntaxFactory.XmlName("cref"),
    SyntaxFactory.Token(SyntaxKind.DoubleQuoteToken),
    cref,
    SyntaxFactory.Token(SyntaxKind.DoubleQuoteToken));

When I added this attribute to an element in a code fix operation with the Simplifier.Annotation annotation, the resulting code for this specific attribute looked like this:

cref="Lazy<T>"

I expected the attribute to actually be emitted as:

cref="Lazy{T}"

❓ How can I produce a correct cref attribute for an XML documentation comment from an arbitrary TypeSyntax?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions