Migrate GetReferenceAssemblyPaths task to TaskEnvironment API#13495
Merged
OvesN merged 7 commits intodotnet:mainfrom Apr 14, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the built-in GetReferenceAssemblyPaths task to the TaskEnvironment API to support correct path resolution under multithreaded MSBuild execution, and updates internal caching to be thread-safe.
Changes:
- Mark
GetReferenceAssemblyPathsas multithreadable and route relative path resolution throughTaskEnvironment.GetAbsolutePath. - Replace a non-thread-safe static cache (
bool?) with a thread-safeLazy<bool>for the .NET 3.5 SP1 sentinel GAC lookup. - Add unit tests validating relative vs absolute behavior for
RootPathandTargetFrameworkFallbackSearchPaths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Tasks/GetReferenceAssemblyPaths.cs | Adds TaskEnvironment integration, multithreadable task surface, and thread-safe sentinel caching. |
| src/Tasks.UnitTests/GetReferencePaths_Tests.cs | Adds regressions to ensure relative inputs resolved via TaskEnvironment match absolute-input behavior. |
…enceAssemblyPaths-task-to-Task-Environment-API
…enceAssemblyPaths-task-to-Task-Environment-API
…enceAssemblyPaths-task-to-Task-Environment-API
Member
|
/review |
Contributor
|
✅ Expert Code Review (command) completed successfully! |
JanProvaznik
approved these changes
Apr 10, 2026
SimaTian
approved these changes
Apr 14, 2026
…enceAssemblyPaths-task-to-Task-Environment-API
This was referenced Apr 15, 2026
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 #13494
Context
The
GetReferenceAssemblyPathstask was made thread-safe for multithreaded MSBuild execution.Changes Made
GetReferenceAssemblyPaths.cs
static bool? s_net35SP1SentinelAssemblyFoundwithstatic readonly Lazy<bool>usingLazyThreadSafetyMode.PublicationOnlyto ensure thread-safe initialization while preserving retry-on-failure behavior.Testing
GetReferencePaths_Tests.cs
RootPath, once with a relativeRootPathresolved viaTaskEnvironment) and asserts identical output, validating that theTaskEnvironment.GetAbsolutePath()integration preserves behavior.TargetFrameworkFallbackSearchPaths: verifies a relative fallback path resolved viaTaskEnvironmentproduces the same result as the equivalent absolute path.