Skip to content

XML documentation generator produce invalid XML #12649

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
Hello,

I am using Visual Studio 2022, and I found the XML documentation generator (which uses code information and XML syntax in comments to produce a XML file, for documenting the code with other programs) is not escaping correctly the name of the type when writing to the XML file. This results in an invalid XML file.

I reproduced the problem with a simple new project, here is a definition of a "Equals" member in F# :

! [image.png] (https://aka.ms/dc/image?name=B324069870c3043eabc893b22b8423cbe637746699889660493_20211209-130627-image.png&tid=324069870c3043eabc893b22b8423cbe637746699889660493)

which produces the faulty XML document :

! [image.png] (https://aka.ms/dc/image?name=B43ea1d48504347b28d7270782c215d6b637746700504610712_20211209-130729-image.png&tid=43ea1d48504347b28d7270782c215d6b637746700504610712)

Please note that I have no control on how the name is generated by the documentation generator; my comment is simply "Test 3." and has no XML tag in it, so the problem is on the generator's side, it seems the angle brackets of the generic type is causing the problem.

I am not able to attach .fs files in the bug report (the filter on the Web site upload interface seems to block it) so here it is :

namespace XMLDocInvalid

module Say =
    /// Test comment for type
    [<CustomComparison; CustomEquality>]
    type MyType =
        | A of int
        | B of bool
        interface System.IComparable<MyType> with

/// test 1.
            member this. CompareTo _ = 0

interface System.IComparable with

/// test 2.
            member this. CompareTo _ = 0

interface System.IEquatable<MyType> with

/// test 3.
            member this. Equals _ = true

/// test 4.
        override this. Equals _ = true

/// test 5.
        override this. GetHashCode() = 0xC0FFEE

let hello =
        let x = A 42
        printfn "Hello %A" x

Thank you.


Original Comments

(no comments)


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-XmlDocsxmldoc generation, xmldoc contentBug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions