dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Documentation Provider in OOP host is returning invalid XML #18191

Open rynowak opened 7 years ago

rynowak commented 7 years ago

Version Used: VS 15.1 (26323.4 vsuwpt)

Steps to Reproduce:

Using the Razor OOP functionality, we're seeing inconsistency in the XML data returned by calls to ISymbol.GetMemberDocumentationXml(). When called in the VS process, ISymbol.GetMemberDocumentationXml() works as-expected. When running in the OOP host, the return values are missing the wrapper element that makes them valid XML.

This means that if a member has a summary and remarks defined, then the return value will not be considered valid XML (two root elements).

Expected Behavior:

For a type like https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/AnchorTagHelper.cs#L25

        <doc>
            <summary>
            <see cref="T:Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper"/> implementation targeting &lt;a&gt; elements.
            </summary>
        </doc>

For a member like https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/AnchorTagHelper.cs#L105::

<doc>   
    <summary>
     Name of the route.
     </summary>
     <remarks>
     Must be <c>null</c> if <see cref="Action"/> or <see cref="Controller"/> is non-<c>null</c>.
     </remarks>
</doc>

Actual Behavior:

For a type like https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/AnchorTagHelper.cs#L25

            <summary>
            <see cref="T:Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper"/> implementation targeting &lt;a&gt; elements.
            </summary>

Note that the doc element is not present, summary is the root node.

For a member like https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/AnchorTagHelper.cs#L105::

    <summary>
     Name of the route.
     </summary>
     <remarks>
     Must be <c>null</c> if <see cref="Action"/> or <see cref="Controller"/> is non-<c>null</c>.
     </remarks>

Note that the doc element is not present, this has two root nodes and is not valid XML.

rynowak commented 7 years ago

/cc @alexgav @heejaechang

heejaechang commented 7 years ago

@rynowak thank you for the reporting. looks like a bug in FileBasedXmlDocumentationProvider http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Utilities/Documentation/XmlDocumentationProvider.cs,154