Skip to content

Enable the task authoring analyzer and migrate the tasks that need no code changes - #17491

Merged
ViktorHofer merged 2 commits into
dotnet:mainfrom
ViktorHofer:mt-safe-subset
Sep 4, 2026
Merged

ViktorHofer merged 2 commits into
dotnet:mainfrom
ViktorHofer:mt-safe-subset

Conversation

@ViktorHofer

Copy link
Copy Markdown
Member

Extracted from #17381 to reduce that PR's diff and isolate risk.

Two commits:

Enable the MSBuild task authoring analyzer — bumps Microsoft.Build.* 17.12.50 → 18.8.2 and adds Microsoft.Build.TaskAuthoring.Analyzer, scoped via eng/MultiThreadableTaskAnalyzer.globalconfig to tasks that opt into multithreaded execution.

Worth calling out: the scope is not limited to tasks carrying [MSBuildMultiThreadableTask]. The analyzer also treats anything implementing IMultiThreadableTask as in scope, and ToolTask implements it — so every ToolTask-derived task in the repo is analyzed as of this change. WixToolTaskBase is the only one that trips it today, hence the tool path resolution there.

Opt tasks that need no code changes into multithreaded execution — 24 tasks whose migration required no behavioral change. The diff per file is the attribute, the interface, and the injected TaskEnvironment property.

AzureDevOpsTask is the one exception to annotation-only. It is the base of the annotated Azure Pipelines tasks and reads BUILD_BUILDNUMBER and friends straight off the process, so those reads move to TaskEnvironment. The analyzer does not catch this by itself — it does not resolve the virtual dispatch from Execute into the base — so it was found by inspection rather than by the build.

What was deliberately left out

Every task whose migration replaced Path.GetFullPath with TaskEnvironment.GetAbsolutePath, per #17381 (comment). AbsolutePath does not normalize, so those are behavior changes in classic mode too, not just under -mt. That rules out LocateDotNet, PackageIndex, GenerateFileFromTemplate, GetCMakeArtifactsFromFileApi, GenPartialFacadeSourceGenerator, SignToolTask, GatherTranslatedSource and TranslateSource — three more than the comment named.

ValidateFrameworkPackage is annotation-only on its own but reaches PackageIndex.Load, so it drops out with PackageIndex and the analyzer confirms it.

Local build.cmd is clean with the analyzer enforcing.

Copilot AI lite review requested due to automatic review settings September 4, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It updates core MSBuild dependencies and expands multithreaded task routing/analyzer enforcement across many tasks, warranting final human verification of build/runtime impacts.

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up…
What changed in this PR

Enables MSBuild task multithreading validation and opts a set of tasks into MSBuild’s in-proc multithreaded execution model, primarily by adding [MSBuildMultiThreadableTask], updating MSBuild package versions, and introducing a scoped task authoring analyzer configuration to act as a regression guard.

Changes:

  • Updated Microsoft.Build.* dependencies from 17.12.50 to 18.8.2 and introduced Microsoft.Build.TaskAuthoring.Analyzer (analyzers-only, private assets).
  • Added [MSBuildMultiThreadableTask] to a set of tasks across Arcade SDK, Helix SDK, XliffTasks, Packaging, Installers, and Links tasks.
  • Adjusted WixToolTaskBase to resolve tool paths via TaskEnvironment.GetAbsolutePath to satisfy analyzer expectations and multi-threaded execution semantics.
File Description
src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​WaitForHelixJobCompletion.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​StopAzurePipelinesTestRun.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​StartAzurePipelinesTestRun.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​GetHelixWorkItems.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CreateXUnitWorkItems.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CreateMTPWorkItems.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CreateFailedTestsForFailedWorkItems.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CheckHelixJobStatus.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CheckAzurePipelinesTestResults.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​CancelHelixJob.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Helix/​Sdk/​AzureDevOpsTask.cs Implements IMultiThreadableTask and switches env-var reads to TaskEnvironment.
src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs Resolves tool path using TaskEnvironment.GetAbsolutePath before existence checks / parsing.
src/​Microsoft.DotNet.Build.Tasks.VisualStudio/​Vsix/​GetPkgDefAssemblyDependencyGuid.cs Marks task as multi-threadable; switches base type reference to Task.
src/​Microsoft.DotNet.Build.Tasks.Packaging/​src/​SplitDependenciesBySupport.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Packaging/​src/​GetPackageVersion.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Packaging/​src/​GetPackageDestination.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Packaging/​src/​GetMinimumNETStandard.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Installers/​src/​GenerateMsiVersion.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Installers/​src/​GenerateGuidFromName.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Build.Tasks.Installers/​src/​GenerateCurrentVersion.cs Marks task as multi-threadable.
src/​Microsoft.DotNet.Arcade.Sdk/​src/​GroupItemsBy.cs Marks task as multi-threadable; switches base type reference to Task.
src/​Microsoft.DotNet.Arcade.Sdk/​src/​CompareVersions.cs Marks task as multi-threadable; switches base type reference to Task.
src/​Microsoft.DotNet.Arcade.Sdk/​src/​CalculateAssemblyAndFileVersions.cs Marks task as multi-threadable; switches base type reference to Task.
eng/​Version.Details.xml Bumps MSBuild dependency versions and adds analyzer dependency entry.
eng/​Version.Details.props Updates MSBuild version properties and introduces analyzer version property.
eng/​MultiThreadableTaskAnalyzer.globalconfig Adds scoped configuration for Microsoft.Build.TaskAuthoring.Analyzer and disables selected rules.
eng/​BuildTask.targets References analyzer package and wires in the global analyzer config under conditions.
Directory.Packages.props Adds central package version entry for Microsoft.Build.TaskAuthoring.Analyzer.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread eng/BuildTask.targets Resolved
Copilot AI review requested due to automatic review settings September 4, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Some tasks are opted into multithreaded execution without the TaskEnvironment/IMultiThreadableTask migration needed to ensure path-sensitive operations behave correctly under -mt.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 3 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the…
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but…
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but…
Pre-existing issues (1)
Severity Finding
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View comment
Suppressed comments (1)

eng/BuildTask.targets:45

  • This comment says the analyzer is scoped via ".editorconfig", but the scoping is actually done by eng/MultiThreadableTaskAnalyzer.globalconfig (added below via EditorConfigFiles). Updating the comment will avoid confusion when someone tries to adjust analyzer scope/severities.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see .editorconfig), so it acts as a
    regression guard for already-migrated tasks without flagging the ones still to be migrated.
    Not available when building from source, where the package feeds aren't reachable.

Copilot AI review requested due to automatic review settings September 4, 2026 13:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Several newly-annotated tasks still use raw/relative file paths (e.g., Xliff and aka.ms link tasks) without TaskEnvironment-based path resolution, which can break correctness under in-proc multithreaded execution.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 6 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads…
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads…
Medium severity src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but it…
Pre-existing issues (4)
Severity Finding
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the… View comment
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View comment
Suppressed comments (1)

eng/BuildTask.targets:46

  • The analyzer scope note here references ".editorconfig", but the analyzer is actually configured via eng/MultiThreadableTaskAnalyzer.globalconfig (added to EditorConfigFiles below). Updating this comment avoids confusion for future maintainers when they try to adjust analyzer settings.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see .editorconfig), so it acts as a
    regression guard for already-migrated tasks without flagging the ones still to be migrated.
    Not available when building from source, where the package feeds aren't reachable.
  -->

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It updates core MSBuild dependency versions and changes task execution mode/analyzer enforcement across the repo, which is high-impact and warrants final human validation.

Review tier: Lite
Findings: 6 Medium severity · 1 Low severity

Pre-existing issues (7)
Severity Finding
Medium severity src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but it… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the… View comment
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View comment
Suppressed comments (1)

eng/BuildTask.targets:44

  • The comment mentions scoping via ".editorconfig", but this PR actually scopes the analyzer via eng/MultiThreadableTaskAnalyzer.globalconfig (added to EditorConfigFiles below). Updating the comment avoids confusion for future maintainers.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see .editorconfig), so it acts as a
    regression guard for already-migrated tasks without flagging the ones still to be migrated.

Copilot AI review requested due to automatic review settings September 4, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It updates core MSBuild dependencies and opt-in multithreaded execution across many tasks, which is broad enough that it warrants final human validation despite only a small number of local review findings.

Review tier: Lite
Findings: 6 Medium severity · 1 Low severity

Pre-existing issues (7)
Severity Finding
Medium severity src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but it… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the… View comment
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View comment
Suppressed comments (1)

eng/BuildTask.targets:44

  • The comment says the analyzer is scoped "(see .editorconfig)", but the scoping is actually defined in eng/MultiThreadableTaskAnalyzer.globalconfig (added below and included via EditorConfigFiles). Updating this avoids confusion for future changes to the analyzer scope/settings.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see .editorconfig), so it acts as a
    regression guard for already-migrated tasks without flagging the ones still to be migrated.

Copilot AI review requested due to automatic review settings September 4, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It changes core build/task infrastructure (MSBuild version bump + new analyzer + multithreaded task opt-in), which has broad ecosystem impact and warrants final human verification.

Review tier: Lite
Findings: 6 Medium severity · 3 Low severity

New issues introduced by this change (2)
Severity Finding
Low severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — The constructor XML doc says toolPath is "fully qualified", but the implementation now explicitly…
Low severity src/​Microsoft.DotNet.Helix/​Sdk/​AzureDevOpsTask.cs — The TaskEnvironment injection isn’t limited to multithreaded builds; it’s assigned whenever the…
Pre-existing issues (7)
Severity Finding
Medium severity src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but it… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View comment
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the… View comment
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View comment
Suppressed comments (1)

eng/BuildTask.targets:45

  • The comment says the analyzer is scoped via ".editorconfig", but this PR wires it up using eng/MultiThreadableTaskAnalyzer.globalconfig (added to EditorConfigFiles). Updating the comment would avoid confusion when someone needs to adjust scope/severities later.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see .editorconfig), so it acts as a
    regression guard for already-migrated tasks without flagging the ones still to be migrated.
    Not available when building from source, where the package feeds aren't reachable.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The changes are primarily opt-in annotations plus a small, targeted migration to TaskEnvironment, with only a minor documentation clarification recommended.

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity eng/​BuildTask.targets — The comment says the analyzer is scoped only to tasks opting in via [MSBuildMultiThreadableTask],…
Issues resolved since last review (9)
Severity Finding
Low severity src/​Microsoft.DotNet.Helix/​Sdk/​AzureDevOpsTask.cs — The TaskEnvironment injection isn’t limited to multithreaded builds; it’s assigned whenever the… View resolved comment
Low severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — The constructor XML doc says toolPath is "fully qualified", but the implementation now explicitly… View resolved comment
Medium severity src/​Microsoft.DotNet.XliffTasks/​Tasks/​GatherXlf.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but it… View resolved comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View resolved comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — These tasks are now annotated as [MSBuildMultiThreadableTask], but AkaMSLinksBase reads… View resolved comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​DeleteAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View resolved comment
Medium severity src/​Microsoft.DotNet.Deployment.Tasks.Links/​src/​CreateAkaMSLinks.cs — Adding [MSBuildMultiThreadableTask] opts this task into in-proc multithreaded execution, but… View resolved comment
Medium severity src/​Microsoft.DotNet.Build.Tasks.Workloads/​src/​Wix/​WixToolTaskBase.cs — TaskEnvironment.GetAbsolutePath(toolPath) will throw if toolPath is null/empty, whereas the… View resolved comment
Low severity eng/​BuildTask.targets — The comment says the analyzer scope is configured via ".editorconfig", but this PR wires up… View resolved comment

Comment thread eng/BuildTask.targets Resolved
Copilot AI review requested due to automatic review settings September 4, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It upgrades core MSBuild dependencies and changes execution semantics for multiple tasks, so it warrants final human validation despite the changes being largely mechanical.

Review tier: Lite
Findings: 1 Low severity

Pre-existing issues (1)
Severity Finding
Low severity eng/​BuildTask.targets — The comment says the analyzer is scoped only to tasks opting in via [MSBuildMultiThreadableTask],… View comment
Suppressed comments (1)

eng/BuildTask.targets:46

  • The comment says the analyzer is scoped to tasks annotated with [MSBuildMultiThreadableTask], but the globalconfig only scopes rules 0002/0003/0005; other rules (e.g., 0001/0004/0009/0010/0012-0014) still apply to all ITask implementations. Updating the wording avoids implying that non-migrated tasks can never produce analyzer diagnostics.
    Analyzer that validates tasks opting into MSBuild's multithreaded execution model via
    [MSBuildMultiThreadableTask]. Scoped to those tasks only (see MultiThreadableTaskAnalyzer.globalconfig,
    which also pins each rule's severity), so it acts as a regression guard for already-migrated tasks
    without flagging the ones still to be migrated.
    Not available when building from source, where the package feeds aren't reachable.

ViktorHofer and others added 2 commits September 4, 2026 15:59
Updates Microsoft.Build.* from 17.12.50 to 18.8.2 and references
Microsoft.Build.TaskAuthoring.Analyzer, scoped via
eng/MultiThreadableTaskAnalyzer.globalconfig to tasks that opt into
multithreaded execution.

Note that the scope is not limited to tasks carrying
[MSBuildMultiThreadableTask]: the analyzer also treats anything
implementing IMultiThreadableTask as in scope, and ToolTask implements
that interface. Every ToolTask-derived task in the repo is therefore
analyzed as of this change, which is why WixToolTaskBase needs to
resolve its tool path up front.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Annotates the tasks whose migration required no behavioral change: the
diff is the [MSBuildMultiThreadableTask] attribute, IMultiThreadableTask,
and the injected TaskEnvironment property. The analyzer enabled in the
previous commit verifies each of them reads no ambient process state.

AzureDevOpsTask is the one exception to annotation-only. It is the base
of the annotated Azure Pipelines tasks and reads BUILD_BUILDNUMBER and
friends straight off the process, so those reads move to TaskEnvironment.
The analyzer does not catch this on its own, since it does not resolve
the virtual dispatch from Execute into the base.

Excluded from this change are the tasks whose migration replaced
Path.GetFullPath with TaskEnvironment.GetAbsolutePath. AbsolutePath does
not normalize, so those are behavior changes in classic mode too and are
tracked separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Copilot AI review requested due to automatic review settings September 4, 2026 14:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It upgrades core MSBuild dependencies and introduces new analyzer enforcement that can have broad build impact across task projects and build environments.

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
Low severity eng/​BuildTask.targets — The comment says the analyzer is scoped only to tasks opting in via [MSBuildMultiThreadableTask],… View resolved comment

@ViktorHofer
ViktorHofer enabled auto-merge (squash) September 4, 2026 14:47
@ViktorHofer
ViktorHofer merged commit 945f379 into dotnet:main Sep 4, 2026
15 of 17 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 5, 2026
ViktorHofer added a commit to ViktorHofer/arcade that referenced this pull request Sep 7, 2026
The merge picks up analyzer 18.12 and the globalconfig from dotnet#17491, which
enables MSBuildTask0013 and deepens the MSBuildTask0005 call-chain analysis.
Both report on tasks this branch deliberately leaves out of the migration.

MSBuildTask0013 flags a task that declares IMultiThreadableTask without
[MSBuildMultiThreadableTask]. That combination is intentional here and each
class already documents why: the interface is what makes MSBuild assign
TaskEnvironment (TaskExecutionHost only tests the interface, so it is assigned
in the task host too), while the attribute alone decides routing. Suppressed at
each of the 13 declarations rather than in the globalconfig, so the rule keeps
guarding against an accidental half-migration everywhere else.

MSBuildTask0005 reports 150 file system calls reached through the SignTool and
Workloads helper chains. Those chains are the documented reason SignToolTask and
CreateVisualStudioWorkload are not opted in, so the tasks stay out-of-proc and
the calls remain correct. Neither project contains a task carrying the
attribute, so the rule has nothing in scope there today; suppressed per project
with a pointer to the class comments and issue dotnet#17378. Verified the rule still
fires elsewhere by temporarily reintroducing a violation in Arcade.Sdk.

Also extends the existing NuGetVersionUpdater suppression to 0005, which now
reports the same already-justified Path.GetTempPath call transitively.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: be19d794-fe4f-43fe-9e6e-f6e6b13ec6e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants