Adjust for culture name normalization in AssemblyNameInfoFuzzer #114231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fuzzer has discovered something that I was not aware of when authoring the fuzz tests.
When
AssemblyNameInfo.ToAssemblyName
sets theAssemblyName.CultureInfo
:runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/AssemblyNameInfo.cs
Line 160 in 778427c
A
CultureInfo
is being allocated:runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
Lines 82 to 85 in 778427c
Which calls
CultureData.GetCultureData
with the provided name and consumes the returned result:runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Lines 167 to 169 in 778427c
Which internally performs
ToLower
on the provided name, just to be able to cache it:runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Line 683 in 778427c
and later normalizes the name also by lowering it:
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs
Lines 741 to 746 in 778427c