You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S1450 is raised on the following snippet despite foundMultiple being used on both methods
Repro steps
privateclassLookForSinglePropertyAccessExpressionVisitor:ExpressionVisitor{privatePropertyInfofoundProperty;privateboolfoundMultiple;// S1450 FP here (but it's used on both methods)public PropertyInfo GetUsedProperty(Expressionexpression){foundProperty=null;foundMultiple=false;
Visit(expression);if(foundMultiple){thrownew ArgumentException($"{expression} contains more than one property access", nameof(expression));}returnfoundProperty??thrownew ArgumentException($"{expression} contains no property access", nameof(expression));}protectedoverride Expression VisitMember(MemberExpressionnode){if(node.Member is PropertyInfo prop){if(foundProperty!=null){foundMultiple=true;}foundProperty=prop;}returnbase.VisitMember(node);}}
It's a FP, indeed.
I discovered that we already have a reproducer for this on our repo.
I'll make sure to add a link to this since it seems we don't have a ticket for it yet.
Description
S1450 is raised on the following snippet despite
foundMultiple
being used on both methodsRepro steps
Expected behavior
No occurrence of S1450 in the above snippet
Actual behavior
S1450 is raised on the above snippet despite
foundMultiple
being used on both methodsKnown workarounds
None
Related information
The text was updated successfully, but these errors were encountered: