Version Used:
3.6
Steps to Reproduce:
- Get the
DocumentationCommentTriviaSyntax that represents the comment in following snippet:
public class TestMe
{
/// <summary>
/// Some summary.
/// </summary>
/// <value>
/// Some value.
/// </value>
private int i;
}
- Invoke
SyntaxNode.Ancestors() and SyntaxNode.AncestorsAndSelf(true) on the DocumentationCommentTriviaSyntax.
- Compare the results and find out that
Ancestors() does neither return the FieldDeclarationSyntax, nor the ClassDeclarationSyntax, nor the CompilationUnitSyntax.
In contrast, AncestorsAndSelf() returns them all.
Expected Behavior:
Invoking SyntaxNode.Ancestors(true) on a DocumentationCommentTriviaSyntax returns all ancestors, similar to SyntaxNode.AncestorsAndSelf(true), except the trivia (no self).
Actual Behavior:
SyntaxNode.Ancestors(true) invoked on a DocumentationCommentTriviaSyntax returns no ancestors.
SyntaxNode.AncestorsAndSelf(true) invoked on the same DocumentationCommentTriviaSyntax not only returns the trivia as expected, but also all the other ancestors that SyntaxNode.Ancestors(true) is missing to return.
Version Used:
3.6
Steps to Reproduce:
DocumentationCommentTriviaSyntaxthat represents the comment in following snippet:SyntaxNode.Ancestors()andSyntaxNode.AncestorsAndSelf(true)on theDocumentationCommentTriviaSyntax.Ancestors()does neither return theFieldDeclarationSyntax, nor theClassDeclarationSyntax, nor theCompilationUnitSyntax.In contrast,
AncestorsAndSelf()returns them all.Expected Behavior:
Invoking
SyntaxNode.Ancestors(true)on aDocumentationCommentTriviaSyntaxreturns all ancestors, similar toSyntaxNode.AncestorsAndSelf(true), except the trivia (no self).Actual Behavior:
SyntaxNode.Ancestors(true)invoked on aDocumentationCommentTriviaSyntaxreturns no ancestors.SyntaxNode.AncestorsAndSelf(true)invoked on the sameDocumentationCommentTriviaSyntaxnot only returns the trivia as expected, but also all the other ancestors thatSyntaxNode.Ancestors(true)is missing to return.