Description
Changes to Nullable Reference Type Annotations in .NET 6.0
This issue represents a work-in-progress. All breaking changes to nullability annotations will be aggregated into this issue throughout the course of .NET 6.0.
Starting in .NET 5.0, we have been applying nullability annotations to parts of ASP.NET Core. 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 source breaking changes because it leads to the APIs being incompatible or more restrictive, or could result in build-time warnings when used in projects that have nullable reference types enabled.
Please use dotnet/aspnetcore#27564 for further discussions.
Version introduced
.NET 6.0
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
ASP.NET
Affected APIs
- ParameterView.FromDictionary(IDictionary<string, object?>
- Renderer.DispatchEventAsync(UInt64, EventFieldInfo?, EventArgs))
- AuthenticationSchemeOptions.ForwardDefaultSelector
- RangeConditionHeaderValue.ctor(EntityTagHeaderValue)
- IConnectionListener.AcceptAsync(CancellationToken)
- IApplicationDiscriminator.Discriminator
- DataProtectionOptions.ApplicationDiscriminator
- AuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
- CngCbcAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
- CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
- IAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
- ManagedAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
- IKey.CreateEncryptor
- KeyManagementOptions.AuthenticatedEncryptorConfiguration
- KeyManagementOptions.XmlEncryptor
- KeyManagementOptions.XmlRepository
- ICertificateResolver.ResolveCertificate(string thumbprint)
- DataProtectionUtilityExtensions.GetApplicationUniqueIdentifier(this IServiceProvider services)
- FileSystemXmlRepository.DefaultKeyStorageDirectory
- RegistryXmlRepository.DefaultRegistryKey
- CertificateResolver.ResolveCertificate(string thumbprint)
- Endpoint(RequestDelegate, EndpointMetadataCollection, String) Constructor
Definition - Endpoint.RequestDelegate
- RouteValueDictionary.TryAdd(String, Object)
- LinkGenerator.GetUriByAddress
- IFeatureCollection.Set(TFeature)
- FeatureCollection.Set(TFeature)
- IFeatureCollection.Get()
- ITicketStore.RetrieveAsync(string key)
Issue metadata
- Issue type: breaking-change