Skip to content

Enable safe parallelization for installer-related tests - #55997

Merged
Evangelink merged 3 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/installer-parallel-audit
Sep 9, 2026
Merged

Evangelink merged 3 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/installer-parallel-audit

Conversation

@Evangelink

Copy link
Copy Markdown
Member

These test projects currently inherit assembly-wide serialization, even when their tests only perform immutable reads or read-only API queries. This opts the safe suites into method-level execution while preserving serialization where tests share machine-wide state.

  • Enable method-level parallelism for trusted-root bundle checks, whose shared certificate data is initialized thread-safely.
  • Enable method-level parallelism for Windows Installer parsing and read-only unknown-product queries.
  • Keep the VM-based MSI installation suite serial because every test class shares one Hyper-V VM, snapshot graph, and fixed machine paths. Class-level locking would still serialize the entire assembly and provide no parallel work.

Validation is limited to the static resource audit in this change. The consolidated 10-run baseline and changed benchmark will be run after integration.

Copilot AI lite review requested due to automatic review settings August 28, 2026 15:21
@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

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity test/​trustedroots.Tests/​trustedroots.Tests.csproj — Opting this assembly into MethodLevel parallelism makes it likely that multiple test constructors…
What changed in this PR

This PR adjusts MSTest parallelization settings for installer-related test projects in test/ by overriding the repository default (MSTestParallelizeScope=None) on suites claimed to be safe for parallel execution, while keeping the VM-backed MSI installation suite serialized.

Changes:

  • Enable method-level MSTest parallelism for trustedroots.Tests.
  • Enable method-level MSTest parallelism for Microsoft.Win32.Msi.Tests.
  • Explicitly keep dotnet-MsiInstallation.Tests non-parallel via MSTestParallelizeScope=None with an explanatory comment.
File Description
test/​trustedroots.Tests/​trustedroots.Tests.csproj Opts the trusted-roots bundle tests into method-level parallelism.
test/​Microsoft.Win32.Msi.Tests/​Microsoft.Win32.Msi.Tests.csproj Opts MSI parsing/unknown-product query tests into method-level parallelism.
test/​dotnet-MsiInstallation.Tests/​dotnet-MsiInstallation.Tests.csproj Explicitly documents/enforces no parallelism for VM-based install tests.

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

Copilot-Session: 9b523ee8-038d-4010-a1d4-2fe7474ca774
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Build Failure Analysis

Summary — The Windows x64 leg failed to compile because the new trustedroots.Tests/AssemblySetup.cs has a parameter/type mismatch and violates an MSTest analyzer rule (MSTEST0016), both promoted to build errors.

Root cause: AssemblySetup.cs initialize method is malformed

The new file declares public static void Initialize(TestContext _) and then does _ = SdkTestContext.Current; inside the body. Because the parameter is literally named _, that assignment targets the parameter (of type TestContext), not a discard, so the compiler cannot implicitly convert the SdkTestContext return value to TestContext (CS0029). Separately, MSTest's analyzer (MSTEST0016) flags the class because it contains only lifecycle method(s) (no test methods) and is not declared static, which is required for assembly-init-only classes.

Affected files / errors

Proposed fix

Rename the unused parameter so _ in the body is a true discard, and mark the class static since it only holds lifecycle methods:

-[TestClass]
-public class AssemblySetup
+[TestClass]
+public static class AssemblySetup
 {
     [AssemblyInitialize]
-    public static void Initialize(TestContext _)
+    public static void Initialize(TestContext context)
     {
         _ = SdkTestContext.Current;
     }
 }

See inline suggestions below.


Build overview
  • Build: FAILED (767.9s)
  • MSBuild: 18.9.0-preview-26359-118+ba53d0ed3
  • Projects: 234, Errors: 3, Warnings: 1
  • Failed projects: artifacts/toolset/.../Build.proj, sdk.slnx, test/trustedroots.Tests/trustedroots.Tests.csproj
All MSBuild errors (2 + build-failed summary)
Code Project File:Line Message
CS0029 trustedroots.Tests AssemblySetup.cs:12 Cannot implicitly convert type 'SdkTestContext' to 'TestContext'
MSTEST0016 trustedroots.Tests AssemblySetup.cs:7 Test class should have a test method or be static with AssemblyInitialize/AssemblyCleanup

🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit efea4b1

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · auto · 89.3 AIC · ⌖ 1.96 AIC · ⊞ 7.5K · [◷]( · ◷)

@github-actions github-actions Bot 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.

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · auto · 89.3 AIC · ⌖ 1.96 AIC · ⊞ 7.5K · ◷

@Evangelink

Copy link
Copy Markdown
Member Author

Local before/after benchmark

Partial local gain confirmed 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/installer-parallel-audit (efea4b1)
  • 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.

Comparable clean total: 0.213s before -> 0.187s after (0.026s saved, 12.2%).

Project Before After Delta Result
dotnet-MsiInstallation.Tests failed failed n/a base/head failed: requires admin/VM control locally
Microsoft.Win32.Msi.Tests 0.213s 0.187s 0.026s passed
trustedroots.Tests 0.344s failed n/a head build failed: SdkTestContext/TestContext type mismatch

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

@Evangelink
Evangelink enabled auto-merge (squash) September 9, 2026 19:18
@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.

@Evangelink

Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@Evangelink
Evangelink merged commit ba68f76 into dotnet:main Sep 9, 2026
50 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 10, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — ad535ef1 Deployed Sep 9, 2026 by Evangelink via pre_activation #3896
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