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

Re-enable ApiCompat ref<->src assembly validation #81104

Merged
merged 4 commits into from
Jan 25, 2023

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Jan 24, 2023

In https://github.com/dotnet/runtime/pull/81080/files#r1085327303, we noticed that ApiCompat doesn't emit an error for public API differences anymore between the contract and the implementation. While Package Validation still ran and validated implementation assemblies, non packable projects were not correctly validated.

This regressed on Dec, 14th 2022 with 1529058 which enabled ApiCompat for the linker tooling. I moved a property from a props to a targets file which resulted in ApiCompat's ValidateAssemblies feature to not run.

The first part of this fix is to move the property back into a props file and adding a comment to warn about moving that property to a different evaluation order.
The second commit fixes the API compatibility differences that happened since Dec, 14th:

The ApiCompatBaseline txt changes are expected. The baseline lists all the public API differences between 7.0.0 and 8.0.0.

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Jan 24, 2023

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details

In https://github.com/dotnet/runtime/pull/81080/files#r1085327303, we noticed that ApiCompat doesn't emit an error for public API differences anymore between the contract and the implementation. While Package Validation still ran and validated implementation assemblies, non packable projects were not correctly validated.

This regressed on Dec, 14th 2022 with 1529058 which enabled ApiCompat for the linker tooling. I moved a property from a props to a targets file which resulted in ApiCompat's ValidateAssemblies feature to not run.

The first part of this fix is to move the property back into a props file and adding a comment to warn about moving that property to a different evaluation order.
The second commit fixes the API compatibility differences that happened since Dec, 14th:

The ApiCompat.proj baseline changes are expected. The baseline lists all the public API differences between 7.0.0 and 8.0.0.

Author: ViktorHofer
Assignees: ViktorHofer
Labels:

area-Meta

Milestone: -

@roji
Copy link
Member

roji commented Jan 24, 2023

LGTM for the System.Linq side.

@@ -37,25 +37,18 @@ public partial class EnumerableQuery<T> : System.Linq.EnumerableQuery, System.Co
}
public static partial class Queryable
{
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
Copy link
Member

@stephentoub stephentoub Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these because we generally don't include RequiresUnreferencedCodeAttribute in ref files? Or these actually don't exist in the src?

Copy link
Member Author

@ViktorHofer ViktorHofer Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because @roji removed them from the implementation in 76e2be8. In general, RequiresUnreferencedCodeAttribute types are part of the public contract AFAIK.

@ViktorHofer
Copy link
Member Author

CoreLib is failing because locally you usually only compile against one but CI validates all of them. Will send a fix.

@ViktorHofer ViktorHofer merged commit 1145e01 into main Jan 25, 2023
@ViktorHofer ViktorHofer deleted the ReenableApiCompatValidateAssembliesProtection branch January 25, 2023 07:18
@ghost ghost locked as resolved and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants