Search

Symbol.GetDocumentationComments() does not return documentation for metadata symbols. by Sunny Ahuwanya

Active

1
0
Sign in
to vote
Type: Other
ID: 775904
Opened: 1/6/2013 7:11:16 AM
Access Restriction: Public
Symbol.GetDocumentationComments() returns documentation successfully for in source classes/methods/properties, however, it doesn't return documentation for metadata symbols like say a Console.WriteLine symbol.
Details (expand)

Visual Studio Tooling version

Microsoft Roslyn CTP

Steps to reproduce

static void Main(string[] args)
{
    string code = "class C{ static void M(){ int[] arr = {10, 20, 30, 40, 50} }} ";

    //Parse Syntax tree
    var tree = SyntaxTree.ParseText(code);

    //Locate the arrInt identifier in the Syntax tree
    var declarator = tree.GetRoot().DescendantNodesAndSelf().Where(t => t.Kind == SyntaxKind.VariableDeclarator
        && ((VariableDeclaratorSyntax)t).Identifier.ValueText == "arr").First() as VariableDeclaratorSyntax;

    //Create compilation
    var compilation = Compilation.Create("MyCompilation",
        syntaxTrees: new SyntaxTree[] { tree },
        references: new MetadataReference[]{ MetadataReference.CreateAssemblyReference("mscorlib")});

    //Get semantic model
    var model = compilation.GetSemanticModel(tree);

    var symbols = model.LookupSymbols(declarator.Span.Start);

    var getHashCodeSymbol = symbols.Where(s => s.Kind == SymbolKind.Method && s.Name == "GetHashCode").First();
    var doc = getHashCodeSymbol.GetDocumentationComment();

//doc does not contain any documentation information because symbol is a PEMethodSymbol. This occurs for all PE* symbols.
            
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Documentation information is not returned

Expected results

Documentation is returned
File Attachments
0 attachments
Sign in to post a comment.
Posted by Sunny Ahuwanya on 4/15/2013 at 12:34 PM
See http://social.msdn.microsoft.com/Forums/en-US/roslyn/thread/aa99d1ab-2aa6-41da-abd2-6724146881d2 on how to resolve this issue.

It would be nice though if there was a DocumentationProvider included in Roslyn that can pull up and parse XML files from the assembly folder or from Program Files/Reference Assemblies.
Posted by Tobi_B on 1/10/2013 at 10:36 PM
Hi Sunny,

this is an issue I already mentionend in the "Roslyn" forum regarding the June 2012 CTP. And obviously this has not changed within the latest September CTP. Here you will find more details:
http://social.msdn.microsoft.com/Forums/en-US/roslyn/thread/9522978f-211d-43f7-bf10-8f00f5de711a

Hope this sheds some light on your concerns as well.

Kind regards
Tobias
Sign in to post a workaround.