Skip to content

Parallelize Blazor and static web asset tests - #56029

Merged
Evangelink merged 9 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/blazor-swa-parallel-tests
Sep 10, 2026
Merged

Evangelink merged 9 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/blazor-swa-parallel-tests

Conversation

@Evangelink

@Evangelink Evangelink commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

This is the @dotnet/aspnet-blazor-eng CODEOWNERS split from #56015.

It enables MSTest ClassLevel parallelization for the Blazor WebAssembly and Static Web Assets test projects, with shared resources and filesystem paths isolated so parallel classes do not collide.

10× benchmark results

The combined Razor-fixed branch was measured on the same machine under an exclusive benchmark lock. Each iteration ran the identical 54 affected projects sequentially through scripts/RunTests.cs, with the same 90-minute per-project timeout and the same exclusion for the pre-existing hanging interruption test.

Fleet statistic Baseline Changed Improvement
Mean 14,773.837s 7,341.516s 50.31%
Median 14,276.260s 6,742.966s 52.77%
Min 14,193.833s 5,426.805s —
Max 18,277.595s 10,443.242s —

All 10 changed iterations completed with zero timeouts and retained exactly the same 10-project local-environment/prerequisite failure set as all 10 baseline iterations; there were no new or resolved failing projects. These combined-branch measurements provide performance and stability context, not isolated attribution or a per-slice tests-passed claim.

Project medians: Blazor WebAssembly improved from 1,565.421s to 640.283s (59.10%), and Static Web Assets improved from 1,337.848s to 340.583s (74.54%).

CI failure investigation

The first Helix run reported Build_DefaultDocumentAndSpaFallback_CreatesAdditionalEndpoints with an empty endpoint collection. The failing test used a unique caller/file-hashed asset path, its class remained method-serialized, and its work item contained no current-directory mutators. The downloaded binlog completed successfully and recorded index.html plus the original, default-document, and SPA-fallback routes among 43 generated endpoints.

The exact 29-test Helix partition passed 10/10 runs (290/290 tests) under the exclusive benchmark lock. Because the evidence does not support a ClassLevel/shared-state race, no serialization was added. The unrelated dotnet-new.IntegrationTests.dll.1 work item passed 211 tests before its host hung and was killed with exit 137. Empty retry commit d9592144fabae0523cd9f212f3a8b244c7aeee9d started replacement CI build 1575664, which succeeded.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 27b89099-1e47-467a-b435-934b230031f3
@Evangelink

Copy link
Copy Markdown
Member Author

Local before/after benchmark

No comparable clean result on my Windows machine using the SDK repo test runner.

  • Machine: Microsoft Windows 11 Enterprise, AMD RYZEN AI MAX+ 395 w/ Radeon 8060S , 32 logical processors
  • Baseline: origin/main (890dd7f)
  • PR head: dev/amauryleve/blazor-swa-parallel-tests (d959214)
  • Command shape: .\.dotnet\dotnet.exe scripts\RunTests.cs -- --project <project>
  • Reported numbers use the test run duration from the runner output; build/setup wall-clock is excluded.
Project Before After Delta Result
Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests failed failed n/a base/head failed: wasm-tools workload missing locally
Microsoft.NET.Sdk.BlazorWebAssembly.Tests 21m 28.8s failed n/a head failed: generated manifest baseline mismatch
Microsoft.NET.Sdk.StaticWebAssets.Tests 16m 06.8s failed n/a head failed: generated manifest baseline mismatch

Single local run; timings can vary with machine load, but this gives a direct before/after signal on this machine.

@Evangelink
Evangelink marked this pull request as ready for review September 9, 2026 05:52
@Evangelink
Evangelink requested a review from a team as a code owner September 9, 2026 05:52
Copilot AI lite review requested due to automatic review settings September 9, 2026 05:52
@Evangelink
Evangelink enabled auto-merge (squash) September 9, 2026 05:52
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Enabling ClassLevel parallelization for Microsoft.NET.Sdk.BlazorWebAssembly.Tests can cause real test-asset directory collisions across classes due to how CreateAspNetSdkTestAsset scopes its destination directory names today.

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

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity test/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj — Setting MSTestParallelizeScope=ClassLevel for this assembly is likely unsafe because…
What changed in this PR

Enables MSTest ClassLevel parallelization for the Blazor WebAssembly and Static Web Assets test projects, while adding [DoNotParallelize] to specific tests/classes that mutate process-global state (notably the current directory) so they won’t race with other tests.

Changes:

  • Switch MSTest parallelization scope to ClassLevel for Microsoft.NET.Sdk.BlazorWebAssembly.Tests, Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests, and Microsoft.NET.Sdk.StaticWebAssets.Tests.
  • Add [DoNotParallelize] to various Static Web Assets tests (especially *MultiThreadingTest and task-environment tests) that are unsafe under parallel execution.
  • Update comments explaining why [DoNotParallelize] is required (ResourceLock cannot protect readers resolving against process CWD).
File Description
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​UpdatePackageStaticWebAssetsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​StaticWebAssetTaskEnvironmentTests.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​StaticWebAssetsGeneratePackManifestMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​StaticWebAssetsGeneratePackagePropsFileMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​ResolveCompressedAssetsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​ReadStaticWebAssetsManifestFileMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​MergeConfigurationPropertiesMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​GenerateStaticWebAssetsPropsFileMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​GenerateStaticWebAssetsManifestMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​GenerateStaticWebAssetsDevelopmentManifestMultiThreadingTest.cs Update comment rationale; keep [DoNotParallelize].
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​GenerateStaticWebAssetEndpointsPropsFileTest.cs Mark specific test methods [DoNotParallelize] due to process-CWD sensitivity.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​GenerateStaticWebAssetEndpointsManifestMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​FilterStaticWebAssetEndpointsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​DiscoverPrecompressedAssetsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​DefineStaticWebAssetsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​ConcatenateCssFilesMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​ComputeReferenceStaticWebAssetItemsTest.cs Mark a specific test method [DoNotParallelize] due to process-CWD sensitivity.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​ComputeEndpointsForReferenceStaticWebAssetsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​StaticWebAssets/​CollectStaticWebAssetsToCopyMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​Microsoft.NET.Sdk.StaticWebAssets.Tests.csproj Switch MSTest parallelization scope to ClassLevel with updated rationale comment.
test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​ComputeStaticWebAssetsTargetPathsMultiThreadingTest.cs Add [DoNotParallelize] to avoid parallel execution.
test/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj Enable MSTest ClassLevel parallelization.
test/​Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/​Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj Enable MSTest ClassLevel parallelization.

Forward caller file paths when copying ASP.NET test assets and serialize compatibility tests that load prior Razor toolchains.

Co-authored-by: Copilot App <[email protected]>
@Evangelink

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

The publish variant is affected by the same tracked classic Razor regression as the already-quarantined build variant.

Co-authored-by: Copilot App <[email protected]>

@akoeplinger akoeplinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall, just some questions/nits

Document why current-directory mutators require DoNotParallelize and clarify the class-level parallelization rationale.

Co-authored-by: Copilot App <[email protected]>

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

The newly skipped compatibility test references a closed external issue rather than an active SDK tracking issue.

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

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity test/​Microsoft.NET.Sdk.StaticWebAssets.Tests/​ScopedCssIntegrationTests.cs — This newly skips the test while linking only to an issue that is already closed as completed, so…
Issues resolved since last review (1)
Severity Finding
High severity test/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests/​Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj — Setting MSTestParallelizeScope=ClassLevel for this assembly is likely unsafe because… View resolved comment

Evangelink and others added 2 commits September 10, 2026 10:56
Reopen the existing SDK issue and use it as the active removal tracker for the publish compatibility quarantine.

Co-authored-by: Copilot App <[email protected]>
…-swa-parallel-tests

# Conflicts:
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/ScopedCssIntegrationTests.cs
@Evangelink

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

Keep the original build compatibility quarantine on its shared Roslyn tracker while the new publish quarantine uses the active SDK removal issue.

Co-authored-by: Copilot App <[email protected]>
Keep both scoped CSS compatibility quarantines on the existing Roslyn issue, matching main and reviewer guidance.

Co-authored-by: Copilot App <[email protected]>
@Evangelink
Evangelink merged commit c4d0e95 into dotnet:main Sep 10, 2026
26 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 11, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 340f023c Deployed Sep 10, 2026 by Evangelink via pre_activation #4047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants