Repository navigation
Avoid duplicate runtime DLLs in the MSTest UWP adapter - #12238
Conversation
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>
There was a problem hiding this comment.
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.MSBuildstill reaches the deployment throughMicrosoft.Testing.Platform.MSBuild. TheReferencePathfallback 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.
There was a problem hiding this comment.
🧪 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
There was a problem hiding this comment.
🔵 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
|
Final test-triage resolution — Azure Pipelines build 1667511 Resolution: inconclusive, no test failure found. No issue is warranted.
|
|
/backport to rel/4.5 |
|
Started backporting to rel/4.5: https://github.com/microsoft/testfx/actions/runs/42227069891 |
|
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 128NOTE: A PR will be created, but needs to be revised manually! |
Pull request
Summary
The classic UWP payload in
MSTest.TestAdapterduplicates runtime assemblies that should be supplied by their owning NuGet packages. Keep only the adapter and platform-services assemblies underbuildTransitive/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).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
Contententries was tried: NuGet resolved the dependencies correctly, but the real classic UWP tests failed because the AppX layout lacked them.MSBuild.Sdk.ExtrassetsCopyLocalLockFileAssemblies=falsefor UAP. The chosen approach therefore preserves the existing curated deployment set while sourcing it from resolved NuGet runtime assets afterResolveReferences; non-SDK projects useReferencePath. It does not globally enable copying every dependency or change the non-UAP dependency graph.Demonstration
Actual final UAP DLL entries:
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 packagesMSTest 5.0.0-devandMicrosoft.Testing.Platform 3.0.0-dev. The tested source wasa4cfae67be2775a721e77999a3d7b3397e0293e1plus patch SHA-2569A3ACE711A272ED4299CEEDF73D26CD3FE30ABBF70D48929A88CFC43AF815DEC, committed unchanged as615522c575d614ec715e00e251d91d48d3b4a5e1.Pack command, run for both source states:
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-MSBuildMAX_PATHlimits; the temporary alias and caches were removed afterward.The related selection independently discovered and then executed 38 cases: 38 passed, 0 failed, 0 skipped, exit 0. TRX, JUnit, and CTRF reports agree.
PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependenciesand both rows ofPackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependenciesClassicUwp_ConsumesUapAssets_AndRunsPlainAndUiTestsThroughMtpthroughMSTest.Sdk,MSTest, andMSTest.TestAdapterModernUwp_ConsumesUwpAssets_AndRunsPlainAndUiTestsThroughMtponnet10.0-windows10.0.26100.0andnet11.0-windows10.0.26100.0Five 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:
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.