-
Notifications
You must be signed in to change notification settings - Fork 4k
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 up nondeterminism in serializing naming style preferences #45483
Fix up nondeterminism in serializing naming style preferences #45483
Conversation
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.
Looks fine to me, one question though. If the enum represents the same thing, should we just stop producing one of them and deprecate it?
...SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/Serialization/SymbolSpecification.cs
Outdated
Show resolved
Hide resolved
@dibarbet: it's not that there's different entries, there's two entries with the same numeric value. Back in the days we apparently couldn't decide whether TypeKind (which is shared between C# and VB) should use the C# keyword name or the VB keyword name, so we chose "both" as the option and had two entries with the same numeric value. When you call ToString() the framework just has to pick one. |
We have two members in TypeKind that point to the same value, Struct and Structure. Because of this, Enum.ToString(), which under the covers uses a binary search, isn't stable which one it will pick and it can change if other TypeKinds are added. This ensures we keep using the same string consistently. We also have a few members in MethodKind that are also duplicates, but it appears those have kept stable. To be safe, we now serialize explicitly. Fixes dotnet#44714
b728070
to
e93dca6
Compare
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.
Auto-approval
We have two members in TypeKind that point to the same value, Struct and Structure. Because of this, Enum.ToString(), which under the covers uses a binary search, isn't stable which one it will pick and it can change if other TypeKinds are added. This ensures we keep using the same string consistently.
Fixes #44714