diff --git a/src/Microsoft.DotNet.CodeFormatting/Rules/HasNoCustomCopyrightHeaderFormattingRule.cs b/src/Microsoft.DotNet.CodeFormatting/Rules/HasNoCustomCopyrightHeaderFormattingRule.cs index a5b65033..2d0926ca 100644 --- a/src/Microsoft.DotNet.CodeFormatting/Rules/HasNoCustomCopyrightHeaderFormattingRule.cs +++ b/src/Microsoft.DotNet.CodeFormatting/Rules/HasNoCustomCopyrightHeaderFormattingRule.cs @@ -77,10 +77,17 @@ private static bool TryGetStartAndEndOfXmlHeader(SyntaxTriviaList triviaList, ou foreach (var trivia in triviaList) { if (!hasStart && IsBeginningOfXmlHeader(trivia, out start)) + { hasStart = true; + continue; // we need to continue because start and end can be the same token + } + if (!hasEnd && IsEndOfXmlHeader(trivia, out end)) + { hasEnd = true; + continue; // we need to continue because start and end can be the same token + } } return hasStart && hasEnd;