File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
src/Http/Http.Extensions/gen Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -46,10 +46,23 @@ public override void ReportSuppressions(SuppressionAnalysisContext context)
4646 ? diagnostic . AdditionalLocations [ 0 ]
4747 : diagnostic . Location ;
4848
49- if ( location . SourceTree is not { } sourceTree
50- || sourceTree . GetRoot ( ) . FindNode ( location . SourceSpan ) is not InvocationExpressionSyntax node
51- || ! node . TryGetMapMethodName ( out var method )
52- || ! InvocationOperationExtensions . KnownMethods . Contains ( method ) )
49+ if ( location . SourceTree is not { } sourceTree )
50+ {
51+ continue ;
52+ }
53+
54+ // The trim analyzer changed from warning on the InvocationExpression to the MemberAccessExpression in https://github.com/dotnet/runtime/pull/110086.
55+ // To account for this, we need to check if the location is an InvocationExpression or a child of an InvocationExpression.
56+ var node = sourceTree . GetRoot ( ) . FindNode ( location . SourceSpan ) switch
57+ {
58+ InvocationExpressionSyntax s => s ,
59+ { Parent : InvocationExpressionSyntax s } => s ,
60+ _ => null ,
61+ } ;
62+
63+ if ( node is null ||
64+ ! node . TryGetMapMethodName ( out var method ) ||
65+ ! InvocationOperationExtensions . KnownMethods . Contains ( method ) )
5366 {
5467 continue ;
5568 }
You can’t perform that action at this time.
0 commit comments