Skip to content

Commit dfee7ce

Browse files
Break out of loop when candidate is found
@ToddGrun pointed out that the `ComponentTemplateDiagnosticPass` should stop searching a node's ancestors once it is noted as a candidate.
1 parent 82fecfe commit dfee7ce

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentTemplateDiagnosticPass.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ TagHelperPropertyIntermediateNode or // Inside malformed ref attribute
5454
TagHelperDirectiveAttributeIntermediateNode) // Inside a directive attribute
5555
{
5656
_candidates.Add(new IntermediateNodeReference(Parent, node));
57+
58+
// We found a candidate and can stop looking. There's no need to report multiple diagnostics for the same node.
59+
break;
5760
}
5861
}
5962
}

0 commit comments

Comments
 (0)