-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with ForAttributeWithMetadataName being in an inconsistent state after a match. #74468
Conversation
@@ -338,29 +338,34 @@ bool matchesAttributeName(string currentAttributeName, bool withAttributeSuffix) | |||
return false; | |||
|
|||
seenNames.Push(currentAttributeName); | |||
|
|||
foreach (var (aliasName, symbolName) in localAliases) | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view with whitespace off.
} | ||
finally | ||
{ | ||
seenNames.Pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
early exits in the foreach code (a return true;
) was causing us to not pop the vlaues we'd pushed onto this stack, leaving it in an inconsistent state.
In the test case this manifested as us going "we've already seen an attribute with this alias name, so we shouldn't look at it again" when we hit the second attribute.
I considered changing to have a single value that is retruned at the end, after hte pop. but i prefer this as it is more future proof, and clearly ensures that any sort of exiting will always leave things consistent.
…state after a match
98bbe93
to
ef711e8
Compare
Fixes dotnet/runtime#105137