Skip to content

Commit c49c5a5

Browse files
authored
Update src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/ProvideCorrectArgumentsToFormattingMethods.cs
1 parent 4f0bcdd commit c49c5a5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/ProvideCorrectArgumentsToFormattingMethods.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,17 @@ private int FindParameterIndexOfCompositeFormatStringSyntaxAttribute(ImmutableAr
452452
{
453453
for (var i = 0; i < parameters.Length; i++)
454454
{
455-
ImmutableArray<AttributeData> attributes = parameters[i].GetAttributes();
456-
for (int j = 0; j < attributes.Length; j++)
455+
if (String.Equals(parameters[i].Type, SymbolEqualityComparer.Default))
457456
{
458-
if (StringSyntaxAttribute!.Equals(attributes[j].AttributeClass))
457+
foreach (AttributeData attribute in parameters[i].GetAttributes())
459458
{
460-
ImmutableArray<TypedConstant> arguments = attributes[j].ConstructorArguments;
461-
if (arguments.Length == 1 && CompositeFormat.Equals(arguments[0].Value))
459+
if (StringSyntaxAttribute!.Equals(attribute.AttributeClass, SymbolEqualityComparer.Default))
462460
{
463-
return i;
461+
ImmutableArray<TypedConstant> arguments = attribute.ConstructorArguments;
462+
if (arguments.Length == 1 && CompositeFormat.Equals(arguments[0].Value))
463+
{
464+
return i;
465+
}
464466
}
465467
}
466468
}

0 commit comments

Comments
 (0)