Repository navigation
migrate PickBestRid - #54489
Merged
Merged
migrate PickBestRid#54489
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the PickBestRid MSBuild task to MSBuild’s multi-threaded task execution model by implementing IMultiThreadableTask and routing file path resolution through TaskEnvironment, with tests intended to validate behavior in isolated vs fallback execution modes.
Changes:
- Updated
PickBestRidto opt into multi-threaded execution and resolveRuntimeGraphPathviaTaskEnvironment.GetAbsolutePath(...)before file access and runtime graph loading. - Added a new unit test file to validate relative-path resolution and error-message behavior (including avoiding absolutized path leaks).
- Added a coarse-grained lock in
RuntimeGraphCachearound task-object caching of runtime graphs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/Microsoft.NET.Build.Tasks.Tests/GivenAPickBestRidMultiThreading.cs | Adds tests around TaskEnvironment-based path resolution and error messaging for PickBestRid. |
| src/Tasks/Microsoft.NET.Build.Tasks/RuntimeGraphCache.cs | Adds locking around runtime graph caching via BuildEngine registered task objects. |
| src/Tasks/Microsoft.NET.Build.Tasks/PickBestRid.cs | Implements IMultiThreadableTask, uses TaskEnvironment to resolve runtime graph path prior to file operations and caching. |
OvesN
reviewed
Jun 4, 2026
OvesN
left a comment
Contributor
There was a problem hiding this comment.
LGTM, but I would try different solution with the lock. Otherwise this migration seems fine
OvesN
approved these changes
Jun 9, 2026
jankratochvilcz
approved these changes
Jun 9, 2026
jankratochvilcz
left a comment
Contributor
There was a problem hiding this comment.
Leaving one cosmetic comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes dotnet/msbuild#13894
Summary
Migrates
PickBestRidto MSBuild's multithreaded task execution model by opting intoIMultiThreadableTaskand routing path resolution throughTaskEnvironment.Changes
PickBestRid.cs[MSBuildMultiThreadableTask]and implementedIMultiThreadableTaskwithTaskEnvironment = TaskEnvironment.Fallback.RuntimeGraphPathviaTaskEnvironment.GetAbsolutePath(...)beforeFile.ExistsandRuntimeGraphCache.GetRuntimeGraph.RuntimeGraphPathin error messages (no absolutized leak).GivenAPickBestRidMultiThreading.cs(new) — 4 correctness tests:ItResolvesRelativeRuntimeGraphPathAgainstProjectDirectoryMatchingRidOutputContainsOnlyRidNoPathPrefixMatchingRidoutput.MissingFileErrorContainsOriginalRelativePathNotAbsolutizedItProducesIdenticalOutcomeInFallbackAndIsolatedModes_SuccessFallbackand isolatedTaskEnvironment.Validation
PickBestRid.cs.GivenAPickBestRidtests: 6/6 still pass.