Skip to content

Avoid duplicate runtime DLLs in the MSTest UWP adapter - #12238

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/uwp-adapter-packaging
Nov 6, 2026
Merged

Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/uwp-adapter-packaging

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Pull request

Summary

The classic UWP payload in MSTest.TestAdapter duplicates runtime assemblies that should be supplied by their owning NuGet packages. Keep only the adapter and platform-services assemblies under buildTransitive/uap10.0, reducing that folder from 12 DLLs to 2 and the locally packed adapter from 4,264,599 to 2,789,352 bytes (34.6% smaller).

  • Declare the classic UWP bootstrap's TRX and Retry package dependencies only for UAP.
  • Deploy the resolved runtime assets as AppX content instead of embedding another copy in the adapter package.
  • Add package-contract regressions and require all ten runtime dependencies in the real classic UWP application layout.

The other five TFM dependency groups and all 38 other packaged DLL payloads are unchanged.

Design and decision record

This is a packaging correction to the UWP integration introduced by #11118 and #11484, not a new feature requiring a separate RFC.

Simply removing the embedded DLLs and their Content entries was tried: NuGet resolved the dependencies correctly, but the real classic UWP tests failed because the AppX layout lacked them. MSBuild.Sdk.Extras sets CopyLocalLockFileAssemblies=false for UAP. The chosen approach therefore preserves the existing curated deployment set while sourcing it from resolved NuGet runtime assets after ResolveReferences; non-SDK projects use ReferencePath. It does not globally enable copying every dependency or change the non-UAP dependency graph.

Demonstration

Actual final UAP DLL entries:

buildTransitive/uap10.0/MSTest.TestAdapter.dll
buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll

The application still receives its required runtime assemblies, now from their owning packages. All ten consumer-cached shipping packages matched the freshly packed producer hashes, and all thirty runtime DLL copies across the three classic UWP applications matched their resolved NuGet source bytes.

A package-entry transcript is more useful than UI media for this nonvisual change; no application, terminal, or report layout changed.

Validation and regression proof

Validated on Windows x64 with Visual Studio 2026, the repository-pinned .NET SDK 12.0.100-alpha.1.26509.101, Release packages MSTest 5.0.0-dev and Microsoft.Testing.Platform 3.0.0-dev. The tested source was a4cfae67be2775a721e77999a3d7b3397e0293e1 plus patch SHA-256 9A3ACE711A272ED4299CEEDF73D26CD3FE30ABBF70D48929A88CFC43AF815DEC, committed unchanged as 615522c575d614ec715e00e251d91d48d3b4a5e1.

Pack command, run for both source states:

.\build.cmd -pack -c Release -bl

Result: exit 0, 0 warnings, 0 errors; NuGet content and metadata verification passed.

Acceptance commands below preserve the executed options, with only each distinct run-owned artifact directory represented by $results. The passing real-app run used a short alias of this worktree and a fresh, short, marked NuGet cache to avoid desktop-MSBuild MAX_PATH limits; the temporary alias and caches were removed afterward.

$project = 'test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj'
$env:TESTFX_RUN_WINDOWS_APP_MODEL_TESTS = '1'

# Retained package regressions, executed against both the original and final packages.
$filter = 'FullyQualifiedName~WindowsApplicationModelPackageTests.PackedMSTestTestAdapter_ClassicUwp'
.\.dotnet\dotnet.exe test --project $project -c Release --no-build --filter $filter -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$results\execution.binlog" --show-test-results all

# Complete related selection against the final freshly packed packages.
$filter = 'FullyQualifiedName~WindowsApplicationModelPackageTests|FullyQualifiedName~ClassicUwpTests|FullyQualifiedName~ModernUwpTests.ModernUwp_ConsumesUwpAssets_AndRunsPlainAndUiTestsThroughMtp'
.\.dotnet\dotnet.exe test --project $project -c Release --no-build --filter $filter -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$results\execution.binlog" --show-test-results all

The related selection independently discovered and then executed 38 cases: 38 passed, 0 failed, 0 skipped, exit 0. TRX, JUnit, and CTRF reports agree.

Requirement Executed evidence Result
No duplicate UAP payload; aligned UAP-only bootstrap dependencies PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependencies and both rows of PackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependencies 3 passed.
Real classic UWP deployment and activation ClassicUwp_ConsumesUapAssets_AndRunsPlainAndUiTestsThroughMtp through MSTest.Sdk, MSTest, and MSTest.TestAdapter 3 passed; each final TRX contains exactly the expected plain/UI tests, both passed.
Preserve modern UWP behavior ModernUwp_ConsumesUwpAssets_AndRunsPlainAndUiTestsThroughMtp on net10.0-windows10.0.26100.0 and net11.0-windows10.0.26100.0 2 passed; each final TRX contains exactly the expected plain/UI tests, both passed.

Five real applications produced ten passing product results; retry-attempt reports were not double-counted. The registration leak check passed. Existing assembly method-level scheduling and UWP class exclusions were preserved.

Logs, binlogs, result reports, and provenance are retained locally; no diagnostic artifacts have been uploaded. Separate legacy non-SDK UWP/VSTest execution, modern x86/ARM64 builds, servicing branches, and CI were not run.

Test-value evidence

The same three package regression cases were retained while packing the original production state and the final implementation:

Contract Original production layout Final implementation
Only two adapter-owned UAP DLLs Executed: assertion failed, expected 2 DLLs and found 12. Executed: passed.
Explicit UAP TRX and Retry dependencies Executed: both assertions failed, expected one dependency and found none. Executed: both passed.

Red: 3 executed, 3 failed, 0 skipped, process exit 2. Green: 3 executed, 3 passed, 0 skipped, process exit 0. Both source states were freshly packed; these are actual assertion failures, not restore, compilation, discovery, or launch failures.

Remove duplicate runtime DLLs from the adapter package while preserving AppX deployment of resolved dependencies. Add UAP payload and dependency regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:00
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Nov 6, 2026

@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.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

Overall the change is sound. It stops duplicating MTP assemblies inside the classic UWP payload and moves them to NuGet dependencies plus a build-time AppX content target. The nupkg file count (76→66) matches the 10 removed dlls, and the PACKAGE.md note is accurate.

Findings (non-blocking):

  • Windows-only validation. All new package and layout assertions are OSCondition(Windows). Linux and macOS CI cannot exercise the new target or the nuspec dependency groups, so the real validation is the Windows classic-UWP acceptance run. Please confirm it was green for this revision.
  • Target scope and filtering. See the inline comment on the targets file: confirm it is a no-op for modern UWP and WinUI, and check that Microsoft.Testing.Extensions.MSBuild still reaches the deployment through Microsoft.Testing.Platform.MSBuild. The ReferencePath fallback for non-SDK projects matches by filename only.
  • Public contract change. Classic UWP consumers get new transitive package dependencies, which the PR should describe in its release notes. The nuspec test covers the dependency shape.
  • Test-value evidence. The new tests assert the absence of the bundled dlls (fails on the old layout), the dependency declarations (fails without PrivateAssets=none), and the full runtime layout in the AppX package. Red/green execution evidence was not included in what I reviewed. I did not execute any PR code.

@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.

🧪 Test quality review — PR #12238

Compared merge base a4cfae67be2775a721e77999a3d7b3397e0293e1 with head 615522c575d614ec715e00e251d91d48d3b4a5e1. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions; no paired execution records were available, and this workflow does not run tests.

Contract Test / decisive assertion Counterfactual Status
Classic UWP buildTransitive no longer bundles MTP/extension DLLs PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependencies: exact sequence equals the two adapter DLLs Restoring the removed TfmSpecificPackageFile entries adds DLLs and fails the sequence equality Static prediction: detected
TrxReport and Retry declared as UAP10.0.16299-only nuspec dependencies PackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependencies (2 data rows): single dependency with the MTP version in the classic group, none in other groups Reverting PrivateAssets=none removes the dependency and fails ContainsSingle Static prediction: detected
UWP targets deploy resolved runtime assets as AppX content AssertClassicUwpPackageLayout: all 10 DLLs exist in the package layout Dropping the _AddMSTestUwpRuntimeDependencies target leaves the layout without the DLLs Static prediction: detected (needs a Windows UWP build)
Required-entries list and verify-nupkgs.ps1 file count (76 → 66) RequiredTestAdapterEntries and the script count The count follows the 10 removed DLLs Static prediction. The count itself is unverified without a pack.
PACKAGE.md text Not executable None Not applicable

🧵 Parallel safety

STATUS: PARTIAL. The parallel-safety specialist was not run in this session, so coverage is incomplete and this is not a clean result. Manual inspection found the new tests only read the packed MSTest.TestAdapter zip, with no writes and no shared mutable state introduced.

Per-test assessment

Pseudo-mutation evidence is not enumerated; the Test-value evidence section above is static prediction only. The existing-thread deduplication check was not performed, and no inline comments were published.

Result Quality Test Notes How to improve
Pass A (90–100) new WindowsApplicationModelPackageTests.PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependencies An exact ordered sequence assertion pins the full DLL set. None
Pass A (90–100) new WindowsApplicationModelPackageTests.PackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependencies Asserts the dependency version and its absence from other groups per data row. None
Pass B (80–89) mod ClassicUwpTests.AssertClassicUwpPackageLayout The helper asserts all 10 runtime DLLs and reports missing names. It is a helper, not a test method. None

<sub>This advisory review is heuristic and non-blocking.

Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~30 AIC · ⌖ ~1 AIC · ⊞ 8K

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 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.

🔵 Needs a closer look

The new non-SDK UWP ReferencePath deployment branch lacks representative Windows validation of legacy UWP/VSTest packaging and discovery, since the available acceptance tests cover only SDK-style projects.

No open issues 🎉

What changed in this PR

This PR corrects classic UWP packaging in MSTest.TestAdapter, replacing bundled runtime dependencies with assets resolved from their owning NuGet packages.

Changes:

  • Reduce the classic UWP payload from 12 DLLs to two adapter-owned assemblies and expose TRX/Retry dependencies only for UAP.
  • Deploy the selected resolved dependencies as AppX content.
  • Add package-contract regressions, strengthen application-layout checks, and update documentation and package counts.

Test-value evidence: The description reports three regressions failing against the original packages and passing at 615522c575d614ec715e00e251d91d48d3b4a5e1, plus 38 passing related cases. Execution artifacts were not independently verified; legacy non-SDK UWP/VSTest execution remains unvalidated.

File Description
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​WindowsApplicationModelPackageTests.cs Verify the two-DLL payload and UAP-only bootstrap dependencies.
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​ClassicUwpTests.cs Require all ten runtime dependencies in the application layout.
src/​Adapter/​MSTest.TestAdapter/​PACKAGE.md Document classic UWP dependency resolution and deployment.
src/​Adapter/​MSTest.TestAdapter/​MSTest.TestAdapter.csproj Expose UAP dependencies and remove bundled runtime DLLs.
src/​Adapter/​MSTest.TestAdapter/​buildTransitive/​uwp/​MSTest.TestAdapter.targets Add resolved runtime assemblies to AppX content.
eng/​verify-nupkgs.ps1 Reduce the expected adapter package file count by ten.

Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1667511

Resolution: inconclusive, no test failure found. No issue is warranted.

  • Test results: 0 failed or retried tests in the collected CTRF/TRX/JUnit results. 101,524 passed and 848 were skipped.
  • Failed leg: the Windows application-model acceptance job failed before running tests. Its Install Access Database Engine step failed (Start-Process: The specified executable is not a valid application for this OS platform, eng/install-access-database-engine.ps1). The later publish steps then found no artifacts directory, no TRX files and no app-model diagnostics.
  • Category: build or infrastructure failure, not a test failure. It is outside this analysis, so leave it to Build Failure Analysis or a maintainer.
  • Why inconclusive: evidenceIncomplete is true. One artifact download failed, and the Windows app-model acceptance tests produced no results, so they are unverified.
  • Other signals: no crash or hang diagnostics. The 27 slow-test candidates did not show a historical regression.
  • Confidence: high that this is not a test regression. Low for the Windows app-model tests, which never ran.
  • Next step: re-run the Windows application-model acceptance leg. If the installer step keeps failing, check the Access Database Engine download and agent image. This is likely unrelated to the PR changes unless the PR touches that script.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · ~24 AIC · ⌖ ~1 AIC · ⊞ 10K

@Evangelink
Amaury Levé (Evangelink) merged commit df9b675 into main Nov 6, 2026
53 of 55 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/uwp-adapter-packaging branch November 6, 2026 13:32
@github-actions github-actions Bot removed the state/approved Proposal approved; ready for implementation. label Nov 6, 2026
@Evangelink

Copy link
Copy Markdown
Member Author

/backport to rel/4.5

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Started backporting to rel/4.5: https://github.com/microsoft/testfx/actions/runs/42227069891

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Amaury Levé (@Evangelink) backporting to rel/4.5 failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Use NuGet runtime dependencies for the classic UWP adapter
Using index info to reconstruct a base tree...
M	src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
M	src/Adapter/MSTest.TestAdapter/PACKAGE.md
M	test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Auto-merging src/Adapter/MSTest.TestAdapter/PACKAGE.md
CONFLICT (content): Merge conflict in src/Adapter/MSTest.TestAdapter/PACKAGE.md
Auto-merging test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Use NuGet runtime dependencies for the classic UWP adapter
Error: The process '/usr/bin/git' failed with exit code 128

NOTE: A PR will be created, but needs to be revised manually!

Amaury Levé (Evangelink) added a commit that referenced this pull request Nov 6, 2026
…in #12238 (backport to rel/4.5) (#12248)

Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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