File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,8 @@ public StringFormatInfo(Compilation compilation)
346346 return info ;
347347 }
348348
349- if ( TryGetFormatInfoByCompositeFormatStringSyntaxAttribute ( method , out info ) )
349+ if ( StringSyntaxAttribute is not null &&
350+ TryGetFormatInfoByCompositeFormatStringSyntaxAttribute ( method , out info ) )
350351 {
351352 return info ;
352353 }
@@ -448,20 +449,15 @@ private static int FindParameterIndexByParameterName(ImmutableArray<IParameterSy
448449
449450 private int FindParameterIndexOfCompositeFormatStringSyntaxAttribute ( ImmutableArray < IParameterSymbol > parameters )
450451 {
451- if ( StringSyntaxAttribute is null )
452- {
453- return - 1 ;
454- }
455-
456452 for ( var i = 0 ; i < parameters . Length ; i ++ )
457453 {
458454 ImmutableArray < AttributeData > attributes = parameters [ i ] . GetAttributes ( ) ;
459455 for ( int j = 0 ; j < attributes . Length ; j ++ )
460456 {
461- if ( Equals ( attributes [ j ] . AttributeClass , StringSyntaxAttribute ) )
457+ if ( StringSyntaxAttribute ! . Equals ( attributes [ j ] . AttributeClass ) )
462458 {
463459 ImmutableArray < TypedConstant > arguments = attributes [ j ] . ConstructorArguments ;
464- if ( arguments . Length == 1 && Equals ( arguments [ 0 ] . Value , CompositeFormat ) )
460+ if ( arguments . Length == 1 && CompositeFormat . Equals ( arguments [ 0 ] . Value ) )
465461 {
466462 return i ;
467463 }
You can’t perform that action at this time.
0 commit comments