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
{{ message }}
Repository navigation
bug: InstanceValuesInTestClassAnalyzer uses return instead of continue #4859
foreach(varfieldOrPropertyinfieldsAndProperties){vartargetSymbol=GetTarget(assignmentOperation);if(!SymbolEqualityComparer.Default.Equals(targetSymbol?.ContainingType,testClass)){return;// ← Returns from entire method, not just loop iteration}
The return statement exits the entire method when the first field/property doesn't match, instead of continuing to check other fields. This means only the first field/property is analyzed per assignment operation — assignments to later fields go undetected.
Impact
False negatives — real problems in user code won't be caught by this analyzer.
Suggested Fix
if(!SymbolEqualityComparer.Default.Equals(targetSymbol?.ContainingType,testClass)){continue;// ← Should be continue, not return}
Activity
fix: use continue instead of return in InstanceValuesInTestClassAnaly…
fix: use continue instead of return in InstanceValuesInTestClassAnaly…