-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix APICompat errors for atttributes on parameters #49408
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
Conversation
|
Note regarding the 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. |
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
| public bool Expired { get { throw null; } set { } } | ||
| public System.DateTime Expires { get { throw null; } set { } } | ||
| public bool HttpOnly { get { throw null; } set { } } | ||
| [System.Diagnostics.CodeAnalysis.AllowNullAttribute] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change against .NET 5.0, however the implementation indeed doesn't allow null in this case:
runtime/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs
Lines 230 to 233 in 632a56b
| if (string.IsNullOrEmpty(value) || !InternalSetName(value)) | |
| { | |
| throw new CookieException(SR.Format(SR.net_cookie_attribute, "Name", value == null ? "<null>" : value)); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we are still permitting corrections to nullable annotations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are. cc: @stephentoub @jeffhandley
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. We are tracking all of them for a breaking change issue.
dotnet/docs#21202
| @@ -0,0 +1,9 @@ | |||
| CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.AllowNullAttribute' exists on parameter 'left' on member 'System.Runtime.CompilerServices.Unsafe.AreSame<T>(T, T)' in the contract but not the implementation. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to avoid having to add the attributes to the IL as it was verbose because we need to if def depending on the tfm to reference System.Private.CoreLib.
eerhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the linker annotations (DynamicallyAccessedMembers) LGTM. Thanks for fixing this, @safern! Its great that we are ensuring our ref assembly matches our impl assemblies.
stephentoub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this all up.
|
I'll follow up on the browser failures tomorrow. |
This reacts to: dotnet/arcade#7058
The build will fail as we need to update API Compat, but before merging the change in arcade I wanted to do a run on dotnet/runtime and see if there was something weird with the rule going on.