Skip to content

Replace broken ApiCompat setup with SDK package validation - #4673

Merged
jbogard merged 1 commit into
mainfrom
package-validation
Oct 28, 2026
Merged

jbogard merged 1 commit into
mainfrom
package-validation

Conversation

@jbogard

@jbogard jbogard commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The old ApiCompat setup used the Arcade Microsoft.DotNet.ApiCompat beta from the dnceng feed plus bash/PowerShell scripts that curl the previous nupkg. It was commented out during 15.0 and hasn't run since. As a result, ApiCompatBaseline.txt (which the docs link to) still describes the 13 → 14 changes.

This PR replaces it with the SDK's built-in package validation:

  • EnablePackageValidation + PackageValidationBaselineVersion=16.0.0, Windows only. That's the build that produces net471 and packs and publishes (Build.ps1 only packs on the Windows runner).
  • Deletes ApiCompat/ scripts, ApiCompatBaseline.txt, the old ApiCompat properties and ResolvedMatchingContract, and the .gitignore entry for LastMajorVersionBinary.
  • Adds CompatibilitySuppressions.xml and updates docs/source/API-Changes.md to point at it, including how to maintain it across major versions.

What validation found (all suppressed)

Compared with the 16.0.0 baseline (CP0006: members added to public interfaces). These are binary breaks for anyone who implements these interfaces themselves. All of them first shipped in 15.1.1 (a patch release) and 16.1.0:

netstandard2.0 compared with net8.0 (CP0002 ×29, CP0009 ×1), existing by design. On net8.0+ these are default interface members (#if NET8_0_OR_GREATER). On netstandard2.0 and net471 the classes implement them directly (FULL_OR_STANDARD). All are in AutoMapper.Execution / AutoMapper.Internal / MemberMap, which overlaps with the existing public issue about cleaning up AutoMapper.Internal. StringToEnumMapper is sealed only on net8.0+.

From now on, changes like these fail the Windows pack unless they're added to the suppression file deliberately.

Verification

  • Local pack with -p:IsWindows=true (includes net471): fails without the suppression file and passes with it
  • The default non-Windows build leaves EnablePackageValidation empty, so Linux CI is unaffected
  • Solution build: 0 warnings, 0 errors
  • Windows CI is the real check

🤖 Generated with Claude Code

The old setup (Arcade ApiCompat beta from the dnceng feed plus scripts that
downloaded the previous nupkg) was disabled during 15.0 and has not run
since. Package validation is built into the SDK and runs on pack.

It is enabled only on Windows, since that build produces the net471 target
and is the one that packs and publishes. The baseline is 16.0.0.

CompatibilitySuppressions.xml records the existing differences:
- Members added to public interfaces in 15.1.1 / 16.1.0 (DI-enabled
  ConstructUsing, Condition/PreCondition, PolymorphicProjectionsEnabled)
- netstandard2.0 vs net8.0 differences from default interface members that
  are only available on net8.0+, plus StringToEnumMapper being sealed only
  on net8.0+

Replaces ApiCompatBaseline.txt (last updated for 14.0) and updates the
API Changes docs page to point at the suppression file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 22:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T22:18:45.457513Z 45d327f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

🟢 Approval recommended

The package-validation changes have no active review issues requiring resolution.

No open issues 🎉

What changed in this PR

Replaces the inactive ApiCompat setup with SDK package validation, restoring compatibility checks when AutoMapper packages are packed on Windows.

Changes:

  • Enables validation against version 16.0.0 and across target frameworks.
  • Records accepted compatibility differences in a suppression file and documents its maintenance.
  • Removes obsolete validation scripts, baseline output, and configuration.
File Description
src/​AutoMapper/​CompatibilitySuppressions.xml Records accepted baseline and cross-framework compatibility differences.
src/​AutoMapper/​AutoMapper.csproj Enables Windows-only package validation and removes legacy configuration.
src/​AutoMapper/​ApiCompatBaseline.txt Deletes the outdated compatibility report.
src/​AutoMapper/​ApiCompat/​PreBuild.sh Deletes the obsolete Bash baseline-download script.
src/​AutoMapper/​ApiCompat/​PreBuild.ps1 Deletes the obsolete PowerShell baseline-download script.
docs/​source/​API-Changes.md Documents package validation, suppressions, and baseline updates.
.gitignore Removes the obsolete baseline-binary ignore entry.

Review effort: Balanced

@jbogard
jbogard merged commit 63f41ac into main Oct 28, 2026
7 checks passed
@jbogard
jbogard deleted the package-validation branch October 28, 2026 22:05
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.

2 participants