-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Changes to Nullable Reference Type Annotations in .NET 6.0 #21202
Comments
@buyaa-n @eiriktsarpalis Please don't check the boxes in the issue description when you edit it to add an API. That's how I mark whether I've documented them or not. Thanks! |
I'm going to close this issue now. If there are any more nullable reference type annotation changes for .NET 6, please open a new issue. |
#25957 was filed for an annotation change to System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider. Adding the link here for future reference. |
Changes to Nullable Reference Type Annotations in .NET 6.0
This issue represents a work-in-progress. All changes to nullability annotations in the .NET Libraries will be aggregated into this issue throughout the course of .NET 6.0.
Starting in .NET Core 3.0, we have been applying nullability annotations to the .NET Libraries; .NET 5.0 reached 94% coverage across the APIs. From the outset of this effort, we anticipated that mistakes would be made in these annotations and fixes would need to be made. In .NET 6.0, we are updating some annotations that have been previously applied.
Some of these changes are considered breaking changes because they could lead to new build-time warnings--code referencing these APIs will need to be updated when migrating to .NET 6.0. Other changes that are not considered breaking are also documented here as referencing code may benefit from removing operators or pragmas that become unnecessary.
Old behavior
The affected APIs had incorrect nullable reference type annotations and build warnings were either absent or incorrect.
New behavior
New build warnings will be produced and incorrect build warnings will no longer be produced for the affected APIs.
Reason for change
Through feedback and further testing, the nullable annotations for the affected APIs were determined to be inaccurate. The updated annotations now correctly represent the nullability contracts for the APIs.
Recommended action
Update code calling these APIs to reflect the revised nullability contracts.
Category
Affected APIs
(Unchecked items in the list have not yet been documented)
Version introduced: .NET 6.0 Preview 1
dotnet/runtime#42918 [Breaking]
dotnet/runtime#43717 [Non-Breaking]
dotnet/runtime#44880 [Non-Breaking]
dotnet/runtime#44844 [Non-Breaking]
dotnet/runtime#44938 [Breaking]
Version introduced: .NET 6.0 Preview 2
dotnet/runtime#47402 [Non-Breaking]
dotnet/runtime#47598 [Breaking]
[NotNullWhen(true)]
added to hundreds of arguments[NotNullWhen(true)]
added to a few arguments in System.collections missed in the original change[NotNullWhen(true)]
added to more arguments in System.Reflection missed in the original change[NotNullWhen(true)]
added to a few arguments in CoreLib missed in the original changeIssue metadata
The text was updated successfully, but these errors were encountered: