@@ -107,12 +107,12 @@ private static bool TryGetX(InvocationExpressionSyntax invocation, SyntaxNodeAna
107107 if ( invocation . Expression is MemberAccessExpressionSyntax memberAccess &&
108108 ! ( memberAccess . Expression is InstanceExpressionSyntax ) )
109109 {
110- return invocation . TryGetTarget ( KnownSymbol . Type . GetEvent , context . SemanticModel , context . CancellationToken , out getX ) ||
111- invocation . TryGetTarget ( KnownSymbol . Type . GetField , context . SemanticModel , context . CancellationToken , out getX ) ||
112- invocation . TryGetTarget ( KnownSymbol . Type . GetMember , context . SemanticModel , context . CancellationToken , out getX ) ||
113- invocation . TryGetTarget ( KnownSymbol . Type . GetMethod , context . SemanticModel , context . CancellationToken , out getX ) ||
110+ return invocation . TryGetTarget ( KnownSymbol . Type . GetEvent , context . SemanticModel , context . CancellationToken , out getX ) ||
111+ invocation . TryGetTarget ( KnownSymbol . Type . GetField , context . SemanticModel , context . CancellationToken , out getX ) ||
112+ invocation . TryGetTarget ( KnownSymbol . Type . GetMember , context . SemanticModel , context . CancellationToken , out getX ) ||
113+ invocation . TryGetTarget ( KnownSymbol . Type . GetMethod , context . SemanticModel , context . CancellationToken , out getX ) ||
114114 invocation . TryGetTarget ( KnownSymbol . Type . GetNestedType , context . SemanticModel , context . CancellationToken , out getX ) ||
115- invocation . TryGetTarget ( KnownSymbol . Type . GetProperty , context . SemanticModel , context . CancellationToken , out getX ) ;
115+ invocation . TryGetTarget ( KnownSymbol . Type . GetProperty , context . SemanticModel , context . CancellationToken , out getX ) ;
116116 }
117117
118118 getX = null ;
@@ -126,9 +126,20 @@ private static bool TryGetTarget(InvocationExpressionSyntax invocation, IMethodS
126126 if ( GetX . TryGetTargetType ( invocation , context , out var targetType , out instance ) )
127127 {
128128 _ = GetX . TryGetMember ( getX , targetType , name , BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Static | BindingFlags . Instance | BindingFlags . FlattenHierarchy , GetX . AnyTypes , context , out var targetSymbol ) ;
129- target = targetSymbol != null
130- ? new Optional < ISymbol > ( targetSymbol )
131- : default ( Optional < ISymbol > ) ;
129+
130+ if ( targetSymbol is IMethodSymbol method )
131+ {
132+ target = method . AssociatedSymbol == null
133+ ? new Optional < ISymbol > ( targetSymbol )
134+ : default ( Optional < ISymbol > ) ;
135+ }
136+ else
137+ {
138+ target = targetSymbol != null
139+ ? new Optional < ISymbol > ( targetSymbol )
140+ : default ( Optional < ISymbol > ) ;
141+ }
142+
132143 return true ;
133144 }
134145
0 commit comments