Skip to content

Fix broken main: declare new BaseSerializer helper members in InternalAPI#9778

Merged
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/fix-broken-main
Jul 9, 2026
Merged

Fix broken main: declare new BaseSerializer helper members in InternalAPI#9778
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/fix-broken-main

Conversation

@Evangelink

@Evangelink Evangelink commented Jul 9, 2026

Copy link
Copy Markdown
Member

Problem

main is broken. The official build 3018307 failed with RS0051 on all target frameworks of Microsoft.Testing.Platform (netstandard2.0, net8.0, net9.0):

src\Platform\Microsoft.Testing.Platform\IPC\Serializers\BaseSerializer.cs(359,27): error RS0051:
  Symbol 'static ...BaseSerializer.ReadFields(...) -> void' is not part of the declared API
src\Platform\Microsoft.Testing.Platform\IPC\Serializers\BaseSerializer.cs(380,27): error RS0051:
  Symbol 'static ...BaseSerializer.WriteListPayload<T>(...) -> void' is not part of the declared API

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:

The new members were never added to InternalAPI.Unshipped.txt, so the analyzer rejected them.

Fix

BaseSerializer.cs is 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 and net/ variants)
  • Microsoft.Testing.Extensions.HangDump
  • Microsoft.Testing.Extensions.Retry
  • Microsoft.Testing.Extensions.TrxReport
  • Microsoft.Testing.Extensions.MSBuild

(Microsoft.Testing.Platform.MSBuild also compiles the file but has no InternalAPI tracking, so it needs no entry.)

Verification

Release builds of Microsoft.Testing.Platform and 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

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>
Copilot AI review requested due to automatic review settings July 9, 2026 12:14

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.

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(...) and BaseSerializer.WriteListPayload<T>(...) in the platform's root InternalAPI.Unshipped.txt.
  • Declares the same two members in the net/ variant of the platform's InternalAPI.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

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

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.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Build Failure Analysis

Summary — Build failed with 24 RS0051 errors because two new protected static methods on BaseSerializer were declared in the Platform project's InternalAPI.Unshipped.txt but not in the extension projects that compile the same source file directly.

Root cause: Missing InternalAPI.Unshipped.txt entries in extension projects

BaseSerializer.cs is compiled into multiple extension projects as linked source (via <Compile Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\IPC\Serializers\BaseSerializer.cs" Link="..." />). Because the Roslyn Public API Analyzer (RS0051) runs per-compilation, each project that compiles this file requires its own API declaration.

The PR correctly updated:

  • src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
  • src/Platform/Microsoft.Testing.Platform/InternalAPI/net/InternalAPI.Unshipped.txt

But missed these 4 files (which currently contain only #nullable enable):

  • src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
  • src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
  • src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
  • src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt

Affected projects (all failed for the same reason)

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.MSBuild also includes BaseSerializer.cs as 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 (via Csc task)
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 · [◷]( · )

@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. · 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>
Copilot AI review requested due to automatic review settings July 9, 2026 12:31

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.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

…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>
Copilot AI review requested due to automatic review settings July 9, 2026 12:47

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.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@Evangelink Evangelink added the state/needs-review Awaiting review from the team. label Jul 9, 2026
@Evangelink
Evangelink enabled auto-merge (squash) July 9, 2026 13:00
@Evangelink
Evangelink disabled auto-merge July 9, 2026 16:25
@Evangelink
Evangelink merged commit 262117e into main Jul 9, 2026
32 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/fix-broken-main branch July 9, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants