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

Exempt MemberNotNullWhen from genapi ref assembly requirements #70113

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

stephentoub
Copy link
Member

As with MemberNotNull, MemberNotNullWhen is an implementation detail when it refers to a private member (even when attributed on a public API). The tooling shouldn't require it in reference assemblies, as in such situations it a) isn't meaningful to a consumer and b) leaks implementation details.

Fixes #67198 (comment)
cc: @bartonjs, @SteveDunn

As with MemberNotNull, MemberNotNullWhen is an implementation detail when it refers to a private member (even when attributed on a public API).  The tooling shouldn't require it in reference assemblies, as in such situations it a) isn't meaningful to a consumer and b) leaks implementation details.
@ghost
Copy link

ghost commented Jun 1, 2022

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

Issue Details

As with MemberNotNull, MemberNotNullWhen is an implementation detail when it refers to a private member (even when attributed on a public API). The tooling shouldn't require it in reference assemblies, as in such situations it a) isn't meaningful to a consumer and b) leaks implementation details.

Fixes #67198 (comment)
cc: @bartonjs, @SteveDunn

Author: stephentoub
Assignees: stephentoub
Labels:

area-Infrastructure-libraries

Milestone: -

@ViktorHofer ViktorHofer merged commit 2f82cb8 into dotnet:main Jun 2, 2022
@stephentoub stephentoub deleted the exemptmembernotnullwhen branch June 2, 2022 10:25
@SteveDunn
Copy link
Contributor

Thanks for this @stephentoub ! Should DisallowNullAttribute also be added? I added it to my PR and it fixed the compilation error I was getting:

error : Compat issues with assembly System.Security.Cryptography.Xml:
error : CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DisallowNullAttribute' exists on parameter 'value' on member 'System.Security.Cryptography.Xml.EncryptedReference.Uri.set(System.String)' in the implementation but not the reference

@stephentoub
Copy link
Member Author

Should DisallowNullAttribute also be added?

No, that's part of the public signature. The tooling was highlighting a bug in your PR: you have DisallowNull in the implementation but you're missing it in the ref; you need to add it to the ref.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 3, 2022
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.

4 participants