Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Nov 9, 2022

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.

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.
@ghost
Copy link

ghost commented Nov 9, 2022

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

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
cc: @MichalStrehovsky, @ViktorHofer, @joperezr

@jaredpar, another source of non-determinism for your list.

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: -

@stephentoub stephentoub requested a review from joperezr November 10, 2022 02:08
Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stephentoub stephentoub merged commit 6b372fb into dotnet:main Nov 10, 2022
@stephentoub stephentoub deleted the regexdeterministic branch November 10, 2022 10:42
@stephentoub
Copy link
Member Author

/backport to release/7.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3436073260

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build libs with /p:Deterministic=true some libraray make diff

4 participants