Uh oh!
There was an error while loading. Please reload this page.
Options Source Gen Fixes - #91363
Conversation
ghost
commented
Aug 30, 2023
Tagging subscribers to this area: @dotnet/area-extensions-options Issue DetailsPlanning to port these fixes to rc2 The changes in this PR fix the following issues:
|
tarekgh
commented
Aug 30, 2023
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| /// <summary> | ||
| /// Returns a non-randomized hash code for the given string. | ||
| /// We always return a positive value. | ||
| /// </summary> | ||
| internal static int GetNonRandomizedHashCode(string s) | ||
| { | ||
| uint result = 2166136261u; | ||
| foreach (char c in s) | ||
| { | ||
| result = (c ^ result) * 16777619; | ||
| } | ||
| return Math.Abs((int)result); | ||
| } |
There was a problem hiding this comment.
We might want to consider using SHA256 here instead of FNV-1a. I think that's what the compiler itself uses when it needs uniqueness.
There was a problem hiding this comment.
After offline discussion, we decided to stick with FNV-1a.
tarekgh
commented
Aug 31, 2023
Failing tests tracked by #91410 |
Uh oh!
There was an error while loading. Please reload this page.
tarekgh
commented
Aug 31, 2023
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6043270790 |
Planning to port these fixes to rc2
The changes in this PR fix the following issues:
Randomin the source generator and instead use the module name hash. Options source generator shouldn't use random names #90990!when callingValidator.TryValidateValueIEnumerable<T>and tagged with the attributeValidateEnumeratedItems