Migrate GenerateSupportedTargetFrameworkAlias to IMultiThreadableTask#53954
Closed
SimaTian wants to merge 3 commits intodotnet:mainfrom
Closed
Migrate GenerateSupportedTargetFrameworkAlias to IMultiThreadableTask#53954SimaTian wants to merge 3 commits intodotnet:mainfrom
SimaTian wants to merge 3 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates GenerateSupportedTargetFrameworkAlias to support MSBuild multithreaded execution via IMultiThreadableTask, and adds dedicated unit tests validating deterministic and concurrent behavior plus DisplayName metadata handling.
Changes:
- Implement
IMultiThreadableTaskonGenerateSupportedTargetFrameworkAliasand add aTaskEnvironmentproperty. - Add
MetadataKeys.DisplayNameconstant and use it in the task and new tests. - Add a dedicated multithreading/behavioral test suite for
GenerateSupportedTargetFrameworkAlias.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Tasks/Microsoft.NET.Build.Tasks/GenerateSupportedTargetFrameworkAlias.cs | Implements IMultiThreadableTask and switches DisplayName metadata handling to MetadataKeys.DisplayName. |
| src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAGenerateSupportedTargetFrameworkAliasMultiThreading.cs | Adds new concurrency + determinism + metadata propagation tests for the task. |
| src/Tasks/Common/MetadataKeys.cs | Adds MetadataKeys.DisplayName constant. |
Comment on lines
+57
to
+63
| var projectDirs = new string[threadCount]; | ||
| var taskEnvs = new TaskEnvironment[threadCount]; | ||
| var expectedOutputs = new string[threadCount]; | ||
| var observedOutputs = new string?[threadCount]; | ||
| var results = new bool[threadCount]; | ||
| var exceptions = new Exception?[threadCount]; | ||
|
|
There was a problem hiding this comment.
expectedOutputs is declared but never used. The repo sets TreatWarningsAsErrors=True (Directory.Build.props), so this will fail the build with an unused-variable warning. Remove it or use it in the assertions.
GenerateSupportedTargetFrameworkAlias is a pure in-memory task that aliases supported target frameworks. It reads SupportedTargetFramework items, parses them via NuGet.Frameworks, and outputs SupportedTargetFrameworkAlias items with DisplayName metadata. Forbidden API scan: NONE. Task is purely computational (NuGet parsing + string manipulation), no file/env/console/process access. Migration approach: Attribute-only + stub IMultiThreadableTask/TaskEnvironment for API consistency (Pattern A). TaskEnvironment property added per-standard since task has no environment dependencies. Added MetadataKeys.DisplayName constant and replaced string literals in GenerateSupportedTargetFrameworkAlias.cs. Created comprehensive multithreading test suite: - GivenAGenerateSupportedTargetFrameworkAliasMultiThreading.cs - Concurrent correctness via start-gate (ManualResetEventSlim) + explicit tasks - Real behavioral assertions (aliases correctly produced, DisplayName propagated, -windows suffix applied for WPF/WinForms, framework family filtering) - Uses MetadataKeys.* constants only, no string literals - No tautologies, each test verifies meaningful task behavior Review findings addressed: 1. Start-gate pattern (ManualResetEventSlim) instead of Barrier to avoid deadlock 2. Per-task test file (not shared multithreading test suite) 3. MetadataKeys.* constants throughout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
04aa02f to
c6cb5b9
Compare
This was referenced Apr 29, 2026
Open
OvesN
approved these changes
May 5, 2026
Member
|
the attribute is already there |
This was referenced May 5, 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.
Migrates \GenerateSupportedTargetFrameworkAlias\ to support \IMultiThreadableTask.
Changes
Addresses review feedback from #53116
Supersedes
Part of the split of stuck merge-group PR #53116. This is the 5-of-5 split for \GenerateSupportedTargetFrameworkAlias.