Drop MSTest's VSTest bridge dependency on the MTP path#9755
Conversation
Complete Phase 6b of the native MTP integration work by making MSTest's Microsoft.Testing.Platform path native-only. - Remove MSTestBridgedTestFramework and stop gating registration behind MSTEST_EXPERIMENTAL_NATIVE_MTP. - Register MSTestTestFramework as the only MTP test framework. - Drop the MSTest.TestAdapter project reference to Microsoft.Testing.Extensions.VSTestBridge. - Add the direct dependencies that used to flow through the bridge: Microsoft.Testing.Extensions.TrxReport.Abstractions, Microsoft.Testing.Extensions.Telemetry, and Microsoft.TestPlatform.ObjectModel. - Rename BridgedConfiguration to PlatformServicesConfigurationAdapter. - Update trim/discovery tests and comments to the native-only topology. Validated: - build.cmd clean - MSTestAdapter.UnitTests: 45/45 - MSTestAdapter.PlatformServices.UnitTests: 898/898 - build.cmd -pack clean, package validation clean - MSTest acceptance high-signal slice green - Full MSTest acceptance: only the 3 pre-existing local NativeAOT failures remain (same trim-warning environment issue as before) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR completes Phase 6b of the native Microsoft.Testing.Platform (MTP) integration for MSTest (RFC 018). It flips MSTest's MTP path to be native-only: MSTestTestFramework becomes the sole MTP test framework, the VSTest bridge framework and its opt-in gate are removed, and MSTest's MSTest.TestAdapter package no longer depends on Microsoft.Testing.Extensions.VSTestBridge. This finalizes the decoupling so MSTest plugs into MTP directly instead of round-tripping through the VSTest object model.
Changes:
- Remove
MSTestBridgedTestFrameworkand theMSTEST_EXPERIMENTAL_NATIVE_MTPgating;MSTestTestFrameworkis now always used, andMSTestCapabilitiesimplements only the nativeIMSTestTrxReportCapability. - Swap the
MSTest.TestAdapterproject reference toMicrosoft.Testing.Extensions.VSTestBridgefor direct references toTrxReport.Abstractions,Telemetry, and an unconditionalMicrosoft.TestPlatform.ObjectModel. - Rename
BridgedConfigurationtoPlatformServicesConfigurationAdapter, and update trim/discovery tests and code comments to the native-only topology.
Show a summary per file
| File | Description |
|---|---|
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs |
Deletes the now-unused VSTest bridge framework. |
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs |
Drops the env-var gate; always registers MSTestTestFramework; MSTestCapabilities implements only the native TRX capability. |
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/PlatformServicesConfigurationAdapter.cs |
Renames BridgedConfiguration to PlatformServicesConfigurationAdapter. |
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestTestFramework.cs |
Updates the field type to the renamed adapter and clarifies the class summary (removes opt-in remarks). |
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestFilterContext.cs |
Comment update to describe the former bridge behavior in past tense. |
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestTestNodeConverter.cs |
Comment updates referencing the bridge in past tense. |
src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs |
Comment update: internal constructor is used by the native framework. |
src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj |
Replaces the VSTestBridge reference with direct TrxReport.Abstractions/Telemetry references and makes Microsoft.TestPlatform.ObjectModel unconditional. |
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrimTests.cs |
Updates trimmer root assemblies (drops VSTestBridge, adds MSTest.TestAdapter) and comments for the Application Insights telemetry dependency. |
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryTests.cs |
Comment update reflecting that MSTest natively leaves assemblyFullName/returnTypeFullName empty. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 0
- Review effort level: Medium
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.
Review Summary — PR #9755: Drop MSTest's VSTest bridge dependency on the MTP path
Clean, well-scoped PR that completes Phase 6b of the native MTP integration. The removal of MSTestBridgedTestFramework, the MSTEST_EXPERIMENTAL_NATIVE_MTP feature flag, and the bridge project reference are all consistent — no dangling references remain in production or test code.
Verdict Table
| # | Dimension | Verdict | Notes |
|---|---|---|---|
| 1 | Algorithmic Correctness | ✅ Pass | Registration logic simplified; single-path factory is correct |
| 2 | Threading & Concurrency | ✅ Pass | CountdownEvent-based session guard unchanged |
| 3 | Exception Handling | ✅ Pass | No changes to exception semantics |
| 4 | Resource Management | ✅ Pass | IDisposable pattern unchanged |
| 5 | API Design & Contracts | ✅ Pass | Public surface unchanged; AddMSTest signature intact |
| 6 | Performance & Allocation | ✅ Pass | Removes dead-code Environment.GetEnvironmentVariable check on hot path |
| 7 | Cross-TFM / Platform | ✅ Pass | ObjectModel now unconditional (UWP + netfx + net8+); UWP guard preserved on MTP-only refs |
| 8 | Backward Compatibility | ✅ Pass | Experimental flag removed (never shipped publicly); native path was already the production path for anyone opting in |
| 9 | Public API Surface | ✅ Pass | No new public API; PublicAPI.Unshipped.txt empty |
| 10 | Security | ✅ Pass | No security-sensitive changes |
| 11 | Localization | ✅ Pass | No new resources; existing .xlf files untouched |
| 12 | Test Quality | ✅ Pass | Trim/discovery tests properly updated for the new topology |
| 13 | Documentation & Comments | One stale comment in .csproj (see inline) |
|
| 14 | Naming Conventions | i️ Info | VSTestBridgedTestFrameworkSessionAlreadyCreatedErrorMessage resource still uses "Bridged" — cosmetic; renaming would churn 13 .xlf files for no functional gain |
| 15 | Code Duplication | ✅ Pass | Bridge code deleted, not duplicated |
| 16 | Error Propagation | ✅ Pass | Session-already-created error unchanged |
| 17 | Dependency Management | ✅ Pass | Transitive deps made explicit correctly (TrxReport.Abstractions, Telemetry, ObjectModel) |
| 18 | Build & Project File | ✅ Pass | Conditions and PrivateAssets settings are correct |
| 19 | Diagnostic & Observability | ✅ Pass | Trace logger wiring unchanged |
| 20 | Scope Discipline | ✅ Pass | Changes are tightly scoped to bridge removal |
| 21 | Style & Formatting | ✅ Pass | Consistent with codebase conventions |
| 22 | TODO Policy | ✅ Pass | Removed the untracked TODO from the bridge; no new TODOs added |
One Minor Finding
The .csproj comment about Microsoft.TestPlatform.Filter.Source (lines 93–95) still uses present tense ("It flows in transitively via the VSTestBridge today") despite the bridge reference being removed in this PR. See inline suggestion.
Overall: Excellent, clean execution. No blocking or major issues. 👍
Comments that could not be inline-anchored
src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj:95
MINOR — Stale comment (present tense about removed dependency)
This comment still says "It flows in transitively via the VSTestBridge today" — but the VSTestBridge reference was removed in this very PR. The ObjectModel comment just above (lines 87–90) was correctly updated to past tense; this one should match:
<!-- The native Microsoft.Testing.Platform integration (TestingPlatformAdapter\MSTestFilterContext, guarded by
!WINDOWS_UWP) parses VSTest filter expressi…
</details>
🧪 Test quality grade — PR #9755
This advisory comment was generated automatically. Grades are heuristic
|
- AzureFoundry: add DefaultAzureCredential/managed identity auth details and required environment variables (PR #9707) - MSTestTestFramework: new entry documenting the native MTP ITestFramework for MSTest introduced by RFC 018 (PRs #9706, #9743, #9748, #9755) - VSTestBridge: note MSTest no longer depends on it on the MTP path as of MSTest 4.3 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- AzureFoundry: add DefaultAzureCredential/managed identity auth details and required environment variables (PR #9707) - MSTestTestFramework: new entry documenting the native MTP ITestFramework for MSTest introduced by RFC 018 (PRs #9706, #9743, #9748, #9755) - VSTestBridge: note MSTest no longer depends on it on the MTP path as of MSTest 4.3 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CI build (Windows/Linux legs) was already red on main before this PR due to two undeclared internal API surfaces flagged by RS0051: - BaseSerializer.ReadFields / WriteListPayload<T> (added by #9774) — the file is linked into Microsoft.Testing.Platform and the HangDump, Retry, TrxReport and Extensions.MSBuild extensions, so each project's InternalAPI.Unshipped.txt needs the declarations. - PlatformServicesConfigurationAdapter and its members (from #9755) in MSTest.TestAdapter, which only surface on the Windows/net462 TFMs the Linux analysis build never compiled. These are unrelated to the source-gen default change but block this PR's pipeline, so they are fixed here in a separate commit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Complete the #9755 BridgedConfiguration -> PlatformServicesConfigurationAdapter rename: the old type name still lingered in InternalAPI.Shipped.txt and referenced a type that no longer exists. The new name was already added to InternalAPI.Unshipped.txt; drop the three stale shipped entries so the tracked internal-API surface is accurate. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
What
Complete Phase 6b of the native MTP integration work by making MSTest's Microsoft.Testing.Platform path native-only.
This follows:
This PR is the final flip/removal step: MSTest no longer routes the MTP path through
Microsoft.Testing.Extensions.VSTestBridge.Changes
MSTestBridgedTestFrameworkfromMSTest.TestAdapter.MSTEST_EXPERIMENTAL_NATIVE_MTP;MSTestTestFrameworkis now the only MTP test framework.MSTest.TestAdapterproject reference toMicrosoft.Testing.Extensions.VSTestBridge.Microsoft.Testing.Extensions.TrxReport.AbstractionsMicrosoft.Testing.Extensions.TelemetryMicrosoft.TestPlatform.ObjectModelBridgedConfigurationtoPlatformServicesConfigurationAdapter.Validation
build.cmdcleanMSTestAdapter.UnitTests: 45/45MSTestAdapter.PlatformServices.UnitTests: 898/898build.cmd -packclean; package validation cleanRunsettingsTests,FilterTests,HelpInfoTests,TrxReportTests,ThreadingTests)NativeAotTests_WillRunWithExitCodeZero (net8.0)NativeAotTests_WillRunWithExitCodeZero (net10.0)NativeAot_Smoke_TestThose 3 failures are the same local trim-warning environment issue already observed before this PR; the focused trim regression tests were updated and pass on the native-only graph.
Notes
The package graph is now what we wanted from the beginning of this effort:
Microsoft.Testing.Extensions.VSTestBridgeMicrosoft.Testing.Extensions.TrxReport.Abstractions,Microsoft.Testing.Extensions.Telemetry,Microsoft.TestPlatform.ObjectModelCo-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com