Skip to content

Migrate DiscoverDefaultScopedCssItems to IMultiThreadableTask - #54701

Merged
jankratochvilcz merged 2 commits into
dotnet:mainfrom
jankratochvilcz:mt/migrate-discoverdefaultscopedcssitems
Jun 11, 2026
Merged

jankratochvilcz merged 2 commits into
dotnet:mainfrom
jankratochvilcz:mt/migrate-discoverdefaultscopedcssitems

Conversation

@jankratochvilcz

@jankratochvilcz jankratochvilcz commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Migrates DiscoverDefaultScopedCssItems (src/StaticWebAssetsSdk/Tasks/DiscoverDefaultScopedCssItems.cs) to multi-threadable by adding [MSBuildMultiThreadableTask].

Fixes dotnet/msbuild#14029

Perfstar regression (14d, Windows, paired MT vs non-MT, p50 sum across iterations)

Target non-MT (ms) MT (ms) Δ (ms) Δ (%)
ResolveScopedCssInputs 90 7,599 +7,509 +8,343 %

Changes

  • [MSBuildMultiThreadableTask] on the concrete class. No IMultiThreadableTask plumbing needed — the task body only inspects ITaskItem metadata and builds a list (no filesystem / environment / process I/O).

Compatibility sins audit (per migration skill)

24/24 dimensions clean — attribute-only opt-in. No Path.* / File.* / Directory.* / Environment.* / Process.* calls in the task body; no [Output] AbsolutePath leakage; no new null-coalescing; no try/catch reorg; no dictionary keys requiring canonicalization; no exception-type divergence.

Co-authored-by: Copilot [email protected]

Marks the task with [MSBuildMultiThreadableTask] so MSBuild's multithreaded mode skips the per-task TaskHost wrapper. The task body only inspects ITaskItem metadata and builds a list, so no IMultiThreadableTask / TaskEnvironment plumbing is required (attribute-only opt-in per the skill).

Co-authored-by: Copilot <[email protected]>
@jankratochvilcz
jankratochvilcz marked this pull request as ready for review June 11, 2026 11:14
Copilot AI review requested due to automatic review settings June 11, 2026 11:14

foreach (var candidate in Content)
{
var fullPath = candidate.GetMetadata("FullPath");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Checked on this, but we only seem to care about the file name not the full path as such

@jankratochvilcz
jankratochvilcz requested review from AR-May and OvesN June 11, 2026 11:15
@jankratochvilcz jankratochvilcz self-assigned this Jun 11, 2026

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.

Pull request overview

This PR attempts to make DiscoverDefaultScopedCssItems eligible for MSBuild parallel task execution by marking it as multi-threadable.

Changes:

  • Added [MSBuildMultiThreadableTask] to DiscoverDefaultScopedCssItems.

@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

No decoy-style unit test added — not viable here

This is an attribute-only opt-in. A decoy-CWD test of the form used for GenerateStaticWebAssetsManifest / MergeConfigurationProperties is not meaningful: the task body contains no File.*, Directory.*, Path.GetFullPath, Environment.* (except Environment.NewLine, a string constant), or Process.* calls whose behavior could diverge under a different process CWD. There is therefore no observable runtime behavior the migration could regress for the decoy test to catch — the attribute purely toggles whether MSBuild wraps the task in a TaskHost, which a unit test cannot exercise.

@jankratochvilcz
jankratochvilcz enabled auto-merge (squash) June 11, 2026 11:58
@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s), but failed to run 1 pipeline(s).

@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

@jankratochvilcz babysit halted — Helix run on build 1459488 surfaced two real test failures:

  1. Microsoft.NET.Sdk.Razor.Tests.BuildWithComponents31IntegrationTest.Build_Components_WithDotNetCoreMSBuild_Works (windows x64) — emits RZ10007: The attribute 'class' is used two or more times for this element twice on NavMenu.razor. Looks like it could be caused by this PR's multithreaded migration of DiscoverDefaultScopedCssItems (concurrency / shared-state issue producing duplicated attributes).
  2. Microsoft.DotNet.Tests.TelemetryTests.TelemetryFilterTests.SubLevelCommandNameShouldBeSentToTelemetry (macOS arm64) — most likely unrelated.

Not retriggering — these look like real defects, not infra flakes.

@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s), but failed to run 1 pipeline(s).

@jankratochvilcz
jankratochvilcz merged commit 079fb5a into dotnet:main Jun 11, 2026
25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 12, 2026
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.

[Multithreaded] Migrate DiscoverDefaultScopedCssItems in SDK

4 participants