Nullable reference type annotations changed

Starting in ASP.NET Core 5.0, nullability annotations have been applied to parts of the code. From the outset of this effort, mistakes were expected in these annotations and fixes would need to be made. In ASP.NET Core 6.0, some previously applied annotations are being updated. Some of these changes are considered source breaking changes. The changes lead to the APIs being incompatible or more restrictive. The updated APIs may result in build-time warnings when used in projects that have nullable reference types enabled.

For discussion, see GitHub issue dotnet/aspnetcore#27564.

Version introduced

ASP.NET Core 6.0

Old behavior

The affected APIs have incorrect nullable reference type annotations. Build warnings are either absent or incorrect.

New behavior

New build warnings are produced. Incorrect build warnings are no longer 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.

Update code calling these APIs to reflect the revised nullability contracts.

Affected APIs

See also