Skip to content

C#: Order syntax trees before creating compilation #16968

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

Merged

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Jul 12, 2024

This PR is reverting the changes in #16945 and instead orders syntax trees before creating the compilation. I overlooked the fact that we're creating syntax trees on multiple threads, so ordering the files didn't result in a stable order for the syntax trees. This PR fixes that by ordering the syntax trees directly.

This change has an impact on both traced and buildless extraction.

@github-actions github-actions bot added the C# label Jul 12, 2024
@tamasvajk tamasvajk marked this pull request as ready for review July 12, 2024 08:34
@tamasvajk tamasvajk requested a review from a team as a code owner July 12, 2024 08:34
@@ -435,6 +435,8 @@ public static IEnumerable<Action> ReadSyntaxTrees(IEnumerable<string> sources, A
}
}

syntaxTrees.Sort((a, b) => string.Compare(a.FilePath, b.FilePath, StringComparison.Ordinal));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we instead respect the order in which the files were passed to the compiler in traced/binlog mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The binlog extractor is not impacted by this change, because that uses the compilation from the complog API.

For traced extraction it would probably be better to use the order from the arguments, but I'd rather merge this PR and see if it solves our non-determinism issues, and do a follow up PR later. We're anyways using a random order currently.

@tamasvajk tamasvajk merged commit 0839742 into github:main Jul 12, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants