Migrate GetAssemblyVersion to IMultiThreadableTask#53948
Open
SimaTian wants to merge 4 commits intodotnet:mainfrom
Open
Migrate GetAssemblyVersion to IMultiThreadableTask#53948SimaTian wants to merge 4 commits intodotnet:mainfrom
SimaTian wants to merge 4 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates GetAssemblyVersion to support MSBuild multithreaded execution by marking it multi-threadable and implementing IMultiThreadableTask, with unit tests validating behavior and concurrent execution.
Changes:
- Add
[MSBuildMultiThreadableTask]and implementIMultiThreadableTaskonGetAssemblyVersion, including aTaskEnvironmentproperty. - Add a new unit test suite covering interface/property shape, version parsing behavior, error handling, and concurrent execution.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Tasks/Microsoft.NET.Build.Tasks/GetAssemblyVersion.cs | Adds multi-threading support metadata/interface and exposes TaskEnvironment for MSBuild injection. |
| src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAGetAssemblyVersionMultiThreading.cs | Adds behavioral + concurrency tests for the multi-threadable task migration. |
This was referenced Apr 17, 2026
GetAssemblyVersion is a pure in-memory task that parses a NuGet version string and extracts the assembly version portion. No file I/O or path resolution is performed. Migration changes: - Added [MSBuildMultiThreadableTask] attribute - Implemented IMultiThreadableTask interface - Added TaskEnvironment property with #if NETFRAMEWORK fallback Added comprehensive multithreading tests: - Interface implementation verification - TaskEnvironment property validation - Version parsing correctness tests (simple and semantic versions) - Invalid version error handling - Concurrent execution with identical inputs (16 threads with start-gate) - Concurrent execution with different inputs (8 threads) - Output consistency verification All tests use start-gate pattern (TaskCompletionSource) to avoid barrier/Parallel.For deadlock anti-pattern from prior reviews. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
1337335 to
fa68bb5
Compare
Delegates the SDK's TaskEnvironmentDefaults and TaskEnvironmentHelper shims to MSBuild's public TaskEnvironment.Fallback / CreateWithProjectDirectoryAndEnvironment APIs (dotnet/msbuild#13462), and drops the now-unused ProcessTaskEnvironmentDriver polyfill. Pipelines are expected to fail until the consumed MSBuild API target version is bumped to a build that exposes these APIs. Co-authored-by: Copilot <[email protected]>
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.
Migrates \GetAssemblyVersion\ to support \IMultiThreadableTask.
Changes
Supersedes
Part of the split of stuck merge-group PR #53116. This is the 4-of-5 split for \GetAssemblyVersion.