Skip to content
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

Fix concurrent tool restore and version range error #35884

Merged

Conversation

JL03-Yue
Copy link
Member

@JL03-Yue JL03-Yue commented Oct 5, 2023

Customer Impact

In .NET 8 we made a breaking change that changes the current .NET tool installation mechanism from restore a local temporary project to downloading the .NET tool from NuGet. This change was introduced because this previous mechanism has number of side effects, often show up as flaky restore errors because MSBuild concepts like Directory.Build.props, or other heirarchical notions, pollute the restore.

The change, however, affect the behavior in tool restore. For one, the change in tool install affect the parallel tool restore as it might read multiple too info into the same config file. For another, the change of getting tool's version tries to read from a property .originalString that might not exist.

The intended way to fix this is to make the parallel tool restore sequential, and to get rid of reading the .originalString property. To make the tool restore sequential, instead of using AsParallel() in the code, the updated code uses AsEnumerate() to reduce the chance of error. For version, this pull request adds a condition to check if the versionRange passed in is null and set it to a default value.
Both changes are validated by tests.

Testing
Existing unit tests passed without changes. New tested are added to validate tool restore returns the correct version, and tool restore is able to restore multiple tools. The new testing scenarios pass with changes in the pull request.

Risk
Low. This change resolves some errors caused by breaking change by add conditions to set the versionRange and make parallel tool restore sequential, without adding complexity to the behavior.

Current unit tests passed without changes, and new tests are added to validate the change. Even though making parallel tool restore sequential might reduce the speed of tool restore, this is a validate approach because it reduces the risk of issues from concurrent restoration.

Original description
Referred to Add known issue for .NET tool restore in .NET 8 RC2

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Oct 5, 2023
@JL03-Yue JL03-Yue changed the title Fix concurrent tool restore Fix concurrent tool restore and version range error Oct 5, 2023
@JL03-Yue JL03-Yue changed the base branch from release/8.0.1xx-rc2 to release/8.0.1xx October 5, 2023 21:59
@JL03-Yue
Copy link
Member Author

JL03-Yue commented Oct 5, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

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

Looks great!

@wtgodbe
Copy link
Member

wtgodbe commented Oct 6, 2023

Approved over email

@wtgodbe wtgodbe merged commit 857f22d into dotnet:release/8.0.1xx Oct 6, 2023
16 checks passed
@JL03-Yue
Copy link
Member Author

fixes #35999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Tools Servicing-approved untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants