Skip to content

Compiler crash generating XML docs for extension #78768

Closed
@BillWagner

Description

@BillWagner

Version Used: Compiler version: '5.0.0-1.25258.110 (c22dcd0c)'. Language version: preview. (as reported by #error version)

Steps to Reproduce:

Use this source:

namespace ClassLibrary6;

/// <summary>Summary for E</summary>
public static class E
{
    /// <summary>Summary for extension block</summary>
    /// <typeparam name="T">Description for T</typeparam>
    /// <param name="t">Description for t</param>
    extension<T>(T t)
    {
        /// <summary>Summary for M</summary>
        /// <typeparam name="U">Description for U</typeparam>
        /// <param name="u">Description for u</param>
        public void M<U>(U u) => throw null!;

        /// <summary>Summary for P</summary>
        public int P => 0;
    }
}

Set the flag to generate XML docs: <GenerateDocumentationFile>True</GenerateDocumentationFile>

Diagnostic Id:

CSC : error CS1569: Error writing to XML documentation file: Object reference not set to an instance of an object.

From some of my related experiments:

  • This class compiles when GenerateDocumentationFile is false or not set.
  • XML docs can be generated when the receiver isn't a type parameter. (It can include a type parameter, such as IEnumerable<T>, but it can't be a type parameter like T.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions