Repository navigation
Enable package validation with baseline comparison - #1671
Merged
MichaelSimons merged 7 commits intoMay 27, 2026
Merged
MichaelSimons merged 7 commits into
MichaelSimons merged 7 commits into
Conversation
Enables package validation (API compat) for reference packages and targeting packs, comparing the built packages against their upstream NuGet baseline to ensure public API surface compatibility. - Enable EnablePackageValidation with baseline comparison in eng/PackageValidation.targets - Add eng/ExcludeTargetFrameworks.props as single source of truth for TFMs that source-build doesn't include, shared by generator and package validation - Configure PackageValidationBaselineFrameworkToIgnore to skip baseline comparisons for excluded TFMs - Enable strict mode for baseline validation to catch real API breaks - Add CompatibilitySuppressions.xml files for known generator differences - Update documentation (README and copilot instructions) with API compat workflow Fixes dotnet#1424 Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
microsoft.extensions.hosting.abstractions/10.0.0 was removed in dotnet#1666 as an unreferenced package. The suppression file should not have been added back. Co-authored-by: Copilot <[email protected]>
mthalman
approved these changes
May 22, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
left a comment
Member
There was a problem hiding this comment.
This looks good. Do you understand the compatibility differences? LLM might be able to summarize them. I'm curious about anything that stands out that would indicate a misconfiguration in this repo or something that GenAPI should do differently.
…escaping
Address code review feedback by simplifying and consolidating the excluded
target frameworks infrastructure:
**Key Changes:**
1. **Single source of truth**: Replaced duplicate ExcludeTargetFrameworks and
ExcludeTargetFrameworksMSBuildEscaped properties with a single ItemGroup
definition in Directory.Build.props
2. **Consistent escaping**: Use MSBuild::Escape() uniformly on all items for
readability and maintainability, even for literals that don't contain wildcards
3. **Proper separation of concerns**: Refactored GetPackageItems task to accept
ITaskItem[] and convert to string[] before passing to TargetFrameworkRegexFilter,
which now accepts IEnumerable<string> (pure logic, no MSBuild dependencies)
4. **Removed dead code**: Eliminated unused string-based constructor and helper
methods from TargetFrameworkRegexFilter
5. **Simplified file structure**: Deleted eng/ExcludeTargetFrameworks.props as
the list is now centralized in Directory.Build.props
6. **Removed unnecessary condition**: Simplified package validation logic in
eng/PackageValidation.targets
**Benefits:**
- No duplication - single list maintained in one place
- Better readability - wildcards visible with MSBuild::Escape('pattern*')
- Cleaner architecture - logic layer decoupled from MSBuild
- More efficient - deferred LINQ execution, single array allocation
Co-authored-by: Copilot <[email protected]>
Document the specific API compatibility issues being suppressed: - CP0001: Stub type added for netstandard2.0 compilation - CP0002: Missing event accessor members (add_/remove_) - CP0008: Missing [Serializable] attribute - CP0021: Missing notnull generic constraint on return type Co-authored-by: Copilot <[email protected]>
MichaelSimons
force-pushed
the
michaelsimons/enable-package-validation
branch
from
May 26, 2026 18:43
27caaf1 to
113007f
Compare
ViktorHofer
reviewed
May 26, 2026
ViktorHofer
approved these changes
May 26, 2026
Changed CP0008 suppression comments from "[Serializable] attribute" to the actual missing interfaces: IMetadataContainer, ITranslatable, and IBuildCheckResult. Co-authored-by: Copilot <[email protected]>
Member
Author
From my investigation compliments of LLM, I logged the following issues: |
ViktorHofer
approved these changes
May 27, 2026
Member
Author
|
FYI, I logged one more genapi issue - dotnet/sdk#54464 |
Closed
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables package validation (API compat) for reference packages and targeting packs, comparing the built packages against their upstream NuGet baseline to ensure public API surface compatibility.
Fixes #1424
What this does
EnablePackageValidationwith baseline comparison ineng/PackageValidation.targetseng/ExcludeTargetFrameworks.propsas the single source of truth for TFMs that source-build doesn't include, shared by both the package source generator and package validationPackageValidationBaselineFrameworkToIgnoreto skip baseline comparisons for excluded TFMs, eliminating false-positive CP0001 errors for TFMs we intentionally don't buildCompatibilitySuppressions.xmlfiles for packages where the generator produces known differences from the baselineSuppressions
notnullgeneric constraint