Fix non-determinism in Regex source generator#78103
Conversation
The source generator enumerates a Hashtable to write out its contents. When the keys of the Hashtable are strings, string hash code randomization may result in the order of that enumeration being different in different processes, leading to non-deterministic ordering of values written out and thus non-deterministic source generator output.
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsThe source generator enumerates a Hashtable to write out its contents. When the keys of the Hashtable are strings, string hash code randomization may result in the order of that enumeration being different in different processes, leading to non-deterministic ordering of values written out and thus non-deterministic source generator output. Fixes #76774 @jaredpar, another source of non-determinism for your list.
|
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
|
/backport to release/7.0 |
|
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3436073260 |
The source generator enumerates a Hashtable to write out its contents. When the keys of the Hashtable are strings, string hash code randomization may result in the order of that enumeration being different in different processes, leading to non-deterministic ordering of values written out and thus non-deterministic source generator output.
Fixes #76774 (though we'll want to backport this to release/7.0)
cc: @MichalStrehovsky, @ViktorHofer, @joperezr
@jaredpar, another source of non-determinism for your list.