Fix broken main: declare new BaseSerializer helper members in InternalAPI#9778
Conversation
PR #9774 added the protected static ReadFields and WriteListPayload<T> helpers to BaseSerializer, and #9752 enabled InternalAPI tracking. The new members were never declared in InternalAPI.Unshipped.txt, so the public API analyzer failed the build with RS0051 on all target frameworks (netstandard2.0, net8.0, net9.0), breaking main. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to unbreak main, whose official build was failing with RS0051 in Microsoft.Testing.Platform after two PRs landed close together: #9774 added the protected static helpers ReadFields/WriteListPayload<T> to BaseSerializer, and #9752 turned on internal-API (RS0051) tracking for the project. The two new members were never declared in the InternalAPI tracking files, so the analyzer rejected them. The fix adds the two member signatures to the platform's InternalAPI.Unshipped.txt (both the netstandard2.0 root variant and the net/ variant).
Changes:
- Declares
BaseSerializer.ReadFields(...)andBaseSerializer.WriteListPayload<T>(...)in the platform's rootInternalAPI.Unshipped.txt. - Declares the same two members in the
net/variant of the platform'sInternalAPI.Unshipped.txt.
The signatures are accurate, but the fix is incomplete: BaseSerializer.cs is also compiled as shared source into four other InternalAPI-tracked projects (Extensions.HangDump, Extensions.Retry, Extensions.TrxReport, Extensions.MSBuild). Their InternalAPI.Shipped.txt baselines already track BaseSerializer's other members but not these two, so they will each hit the same RS0051 failure once the platform build (their ProjectReference dependency) succeeds. The single-project local verification did not exercise those projects, so the gap went unnoticed. As a result, main would remain broken.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt | Declares the two new BaseSerializer helpers for the netstandard2.0 variant; correct but insufficient alone. |
| src/Platform/Microsoft.Testing.Platform/InternalAPI/net/InternalAPI.Unshipped.txt | Declares the same two helpers for the net8.0/net9.0 variant; correct but insufficient alone. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- 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
✅ All 22 dimensions clean — no issues found.
This is a minimal, correctly-scoped fix for the broken main build (RS0051). Verified:
| Check | Result |
|---|---|
Signatures match source (BaseSerializer.cs:359, :380) |
✅ |
Both TFM variants updated (root + net/) |
✅ |
| Entries alphabetically sorted (R before W) | ✅ |
| Trailing newline present (SA1518) | ✅ |
No other undeclared BaseSerializer members remain |
✅ (27 others already in Shipped.txt) |
| Scope discipline — single concern, no unrelated changes | ✅ |
No inline comments needed — the change is correct as-is.
🔍 Build Failure AnalysisSummary — Build failed with 24 Root cause: Missing
|
| Project | Error count |
|---|---|
Microsoft.Testing.Extensions.HangDump |
6 |
Microsoft.Testing.Extensions.MSBuild |
6 |
Microsoft.Testing.Extensions.Retry |
6 |
Microsoft.Testing.Extensions.TrxReport |
6 |
Proposed fix — Add the same two API declarations to each of the 4 extension project InternalAPI.Unshipped.txt files. Each file should become:
#nullable enable
static Microsoft.Testing.Platform.IPC.Serializers.BaseSerializer.ReadFields(System.IO.Stream! stream, System.Func<ushort, int, bool>! tryReadField) -> void
static Microsoft.Testing.Platform.IPC.Serializers.BaseSerializer.WriteListPayload<T>(System.IO.Stream! stream, ushort fieldId, T[]? list, System.Action<System.IO.Stream!, T>! writeItem) -> void
Note:
Microsoft.Testing.Platform.MSBuildalso includesBaseSerializer.csas linked source but does not have the Public API Analyzer enabled, so it is unaffected.
Build overview
- Result: FAILED
- Duration: 211.2s
- MSBuild: 18.8.0-preview-26302-115
- Projects: 49 total, 6 failed
- Errors: 25 (24
RS0051+ 1 final "Build failed") - Warnings: 0
- Failed target:
CoreCompile(viaCsctask)
All MSBuild errors (24 unique)
| Code | Project | File:Line | Message |
|---|---|---|---|
RS0051 |
HangDump |
BaseSerializer.cs:359 |
Symbol ReadFields(...) is not part of the declared API |
RS0051 |
HangDump |
BaseSerializer.cs:380 |
Symbol WriteListPayload<T>(...) is not part of the declared API |
RS0051 |
MSBuild |
BaseSerializer.cs:359 |
Symbol ReadFields(...) is not part of the declared API |
RS0051 |
MSBuild |
BaseSerializer.cs:380 |
Symbol WriteListPayload<T>(...) is not part of the declared API |
RS0051 |
Retry |
BaseSerializer.cs:359 |
Symbol ReadFields(...) is not part of the declared API |
RS0051 |
Retry |
BaseSerializer.cs:380 |
Symbol WriteListPayload<T>(...) is not part of the declared API |
RS0051 |
TrxReport |
BaseSerializer.cs:359 |
Symbol ReadFields(...) is not part of the declared API |
RS0051 |
TrxReport |
BaseSerializer.cs:380 |
Symbol WriteListPayload<T>(...) is not part of the declared API |
(Each error repeats 3× per project due to multi-targeting — 3 TFMs × 4 projects × 2 symbols = 24 errors.)
🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit c77cd19
🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · 105.3 AIC · ⌖ 7.25 AIC · ⊞ 7.3K · [◷]( · ◷)
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · 105.3 AIC · ⌖ 7.25 AIC · ⊞ 7.3K · ◷
BaseSerializer.cs is compiled as shared source into HangDump, Retry, TrxReport and Extensions.MSBuild, which each have InternalAPI (RS0051) tracking. Add ReadFields and WriteListPayload<T> to their InternalAPI.Unshipped.txt so the whole solution builds, not just Microsoft.Testing.Platform. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ternalAPI With Microsoft.Testing.Platform now building, MSTest.TestAdapter compiles and surfaces its own RS0051 failures for the internal PlatformServicesConfigurationAdapter type (added while InternalAPI tracking was being rolled out in #9752). Declare the type, its constructor and indexer in the non-UWP InternalAPI.Unshipped.txt so the adapter builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Problem
mainis broken. The official build 3018307 failed withRS0051on all target frameworks ofMicrosoft.Testing.Platform(netstandard2.0, net8.0, net9.0):The downstream "Publish Test Results / binlogs" and "OneLocBuild (testsuite not found)" failures are just consequences — the failed build produced no packages/artifacts for those later steps to consume.
Root cause
Two recent changes landed close together:
protected statichelpersReadFieldsandWriteListPayload<T>toBaseSerializer.The new members were never added to
InternalAPI.Unshipped.txt, so the analyzer rejected them.Fix
BaseSerializer.csis compiled as shared source (<Compile Include=... Link=... />) into several projects that each have InternalAPI (RS0051) tracking. The two new members are declared in every one of them:Microsoft.Testing.Platform(both the netstandard2.0 root andnet/variants)Microsoft.Testing.Extensions.HangDumpMicrosoft.Testing.Extensions.RetryMicrosoft.Testing.Extensions.TrxReportMicrosoft.Testing.Extensions.MSBuild(
Microsoft.Testing.Platform.MSBuildalso compiles the file but has no InternalAPI tracking, so it needs no entry.)Verification
Release builds of
Microsoft.Testing.Platformand all four tracked extensions succeed with 0 warnings, 0 errors across net8.0, net9.0, and netstandard2.0.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com