Skip to content

Add support for XML documentation in the generator #17397

@rolfbjarne

Description

@rolfbjarne

Ref: #14372, step 4

The idea is to add support in the generator for writing XML documentation based on an attribute in the api definition:

This would be the attribute:

public class DocumentationAttribute : Attribute {
    public DocumentationAttribute ()
    {
    }

    public DocumentationAttribute (string xml)
    {
        this.Xml = xml;
    }
 
    public string Xml { get; set; }
    public string Include { get; set; }
    public string XmlPath { get; set; }
}

and this would be how to use it:

[Documentation (
@"
/// <summary>
/// Documentation for UIView
/// </summary>
")
]
public interface UIView {
}

[Documentation (Include = "/path/to/file.xml", XmlPath = "Type@[FullName='UIKit.UIView']/Docs/*")]
public interface UIView {
}

MAUI example with include path: https://github.com/dotnet/maui/blob/6377c3259387913f3acc7f7858028f7c97a0480b/src/Controls/src/Core/Application.cs#L17

Metadata

Metadata

Assignees

Labels

documentationThe issue or pull request is about documentationdotnetAn issue or pull request related to .NET (6)generatorIssues affecting the generator

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions