Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn PackageValidation on by default #23910

Open
10 of 18 tasks
safern opened this issue Feb 12, 2022 · 0 comments
Open
10 of 18 tasks

Turn PackageValidation on by default #23910

safern opened this issue Feb 12, 2022 · 0 comments
Labels
Area-ApiCompat User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@safern
Copy link
Member

safern commented Feb 12, 2022

In .NET 6 we added a new tool to help library developers author their packages without breaking changes by raising errors after the Pack target is executed. Currently that tool is opt-in, which means authors of libraries, need to set <EnablePackageValidation>true</EnablePackageValidation> in their csproj's.

In order to turn it on by default we need to investigate/invest in different areas:

Performance

Diagnostic experience

Do we have a good error experience?

We should evaluate if we can improve this experience by making errors more actionable maybe with adding support to suppress them via the IDE. If someone creates the package today from Visual Studio, they would get the errors, however, to suppress them if they are intentional, they need to run dotnet pack /p:GenerateCompatibilitySuppressionFile=true; which means having to leave the IDE.

Is the suppressions file readable?

Compatibility Rules

Currently if we were to turn package validation on by default, all our costumers would get errors if any, and they would start discovering this tool, however, we don't have a complete set of rules to cover all breaking changes, that can compromise our costumers trust, because they could ship a package thinking that they are fully compatible because their pack target was clean. However, with the gaps of rules we would be lying as a breaking change could be introduced and not caught because a rule is missing.

Current list of implemented rules

  • Types must exist
  • Members must exist (this covers adding an optional parameter to a current member)
  • Assembly identity should match
  • Can not add abstract member to unsealed type
  • Can not add member to interface without default implementation
  • Can not remove base type or interface from hierarchy tree
  • Can not seal type

Missing Rules

Some of the missing rules are dependent on having references loaded as part of the compilation, so maybe completion of this issue is needed as well:

That scenario is already covered for comparing assemblies within the same package, however we didn't enable it for package baseline validation because there was not a good way to get the dependencies for the package baseline since we are using package download and we can't get dependencies for it. This would be something we can collaborate with NuGet to improve the experience of baseline validation.

Support Multiple Assemblies On Packages

Currently, we just focused on the simple scenario that a package contained only a single assembly and the assembly was named the same as the package id. However, this is not true for packages out there, a package can have multiple assemblies that have different names, and we should ensure we run validation for those assemblies.

Support automatically getting latest released package

For package baseline validation we should explore the option of supporting fetching the latest stable released package to run baseline validation again. Also, there is a first party request to support wildcards or some form of range to automatically get the baseline package version respecting that range:

cc: @joperezr @ericstj

@safern safern added User Story A single user-facing feature. Can be grouped under an epic. Area-ApiCompat labels Feb 12, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Feb 12, 2022
@safern safern removed the untriaged Request triage from a team member label Feb 12, 2022
@smasher164 smasher164 added this to the 8.0.1xx milestone Oct 19, 2022
@ViktorHofer ViktorHofer modified the milestones: 8.0.1xx, Backlog Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-ApiCompat User Story A single user-facing feature. Can be grouped under an epic.
Projects
None yet
Development

No branches or pull requests

3 participants