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.
Recommended action
Update code calling these APIs to reflect the revised nullability contracts.
Affected APIs
- ParameterView.FromDictionary
- Renderer.DispatchEventAsync
- RenderTreeEdit.RemovedAttributeName
- AuthenticationSchemeOptions.ForwardDefaultSelector
- RangeConditionHeaderValue.RangeConditionHeaderValue
- IConnectionListener.AcceptAsync
- IApplicationDiscriminator.Discriminator
- DataProtectionOptions.ApplicationDiscriminator
- AuthenticatedEncryptorFactory.CreateEncryptorInstance
- CngCbcAuthenticatedEncryptorFactory.CreateEncryptorInstance
- CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance
- IAuthenticatedEncryptorFactory.CreateEncryptorInstance
- ManagedAuthenticatedEncryptorFactory.CreateEncryptorInstance
- IKey.CreateEncryptor
- KeyManagementOptions.AuthenticatedEncryptorConfiguration
- KeyManagementOptions.XmlEncryptor
- KeyManagementOptions.XmlRepository
- ICertificateResolver.ResolveCertificate
- DataProtectionUtilityExtensions.GetApplicationUniqueIdentifier
- FileSystemXmlRepository.DefaultKeyStorageDirectory
- RegistryXmlRepository.DefaultRegistryKey
- CertificateResolver.ResolveCertificate
- Endpoint.Endpoint
- Endpoint.RequestDelegate
- RouteValueDictionary.TryAdd
- LinkGenerator.GetUriByAddress
- IFeatureCollection.Set
- FeatureCollection.Set
- IFeatureCollection.Get
- ITicketStore.RetrieveAsync
- IFeatureCollection.Get<TFeature>()
- IFeatureCollection.Set<TFeature>(TFeature)
- FeatureCollection.Set<TFeature>(TFeature)
- ModelStateDictionary.SetModelValue(String, Object, String)
- ModelStateDictionary.Item[String]
- ClientValidatorItem.ClientValidatorItem
- ClientValidatorItem.Validator
- Endpoint.Endpoint
- RouteValueDictionary.TryAdd(String, Object)>
- LinkGenerator.GetUriByAddress<TAddress>(TAddress, RouteValueDictionary, String, HostString, PathString, FragmentString, LinkOptions)
- IApplicationDiscriminator.Discriminator
- DataProtectionOptions.ApplicationDiscriminator
- AuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey)
- CngCbcAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey)
- CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey)
- IAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey)
- ManagedAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey)
- IKey.CreateEncryptor()
- KeyManagementOptions.AuthenticatedEncryptorConfiguration
- KeyManagementOptions.XmlEncryptor
- KeyManagementOptions.XmlRepository
- ICertificateResolver.ResolveCertificate(String)
- DataProtectionUtilityExtensions.GetApplicationUniqueIdentifier(IServiceProvider)
- FileSystemXmlRepository.DefaultKeyStorageDirectory
- RegistryXmlRepository.DefaultRegistryKey
- CertificateResolver.ResolveCertificate(String)
- IConnectionListener.AcceptAsync(CancellationToken)
- AuthenticationSchemeOptions.ForwardDefaultSelector
- RangeConditionHeaderValue.RangeConditionHeaderValue(EntityTagHeaderValue)
- IHttpContextFeature.HttpContext
- CompletionMessage.WithError
- CompletionMessage.WithResult
- HubMethodInvocationMessage.Arguments
- HubMethodInvocationMessage.HubMethodInvocationMessage(String, String, Object[])
- HubMethodInvocationMessage.HubMethodInvocationMessage(String, String, Object[], String[])
- InvocationMessage.InvocationMessage(String, Object[])
- InvocationMessage.InvocationMessage(String, String, Object[])
- InvocationMessage.InvocationMessage(String, String, Object[], String[])
- StreamInvocationMessage.StreamInvocationMessage(String, String, Object[])
- StreamInvocationMessage.StreamInvocationMessage(String, String, Object[], String[])
- IHubProtocol.TryParseMessage(ReadOnlySequence<Byte>, IInvocationBinder, HubMessage)
- DefaultHubLifetimeManager<THub>.SendAllAsync(String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendAllExceptAsync(String, Object[], IReadOnlyList<String>, CancellationToken)
- DefaultHubLifetimeManager<THub>.SendConnectionAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendConnectionsAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupExceptAsync(String, String, Object[], IReadOnlyList<String>, CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupsAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendUserAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendUsersAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendAllAsync(String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendAllExceptAsync(String, Object[], IReadOnlyList<String>, CancellationToken)
- DefaultHubLifetimeManager<THub>.SendConnectionAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendConnectionsAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupExceptAsync(String, String, Object[], IReadOnlyList<String>, CancellationToken)
- DefaultHubLifetimeManager<THub>.SendGroupsAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendUserAsync(String, String, Object[], CancellationToken)
- DefaultHubLifetimeManager<THub>.SendUsersAsync(IReadOnlyList<String>, String, Object[], CancellationToken)
- IClientProxy.SendCoreAsync
- HubConnectionContext.User
- QueryHelpers.ParseNullableQuery(String)
- QueryHelpers.ParseQuery(String)
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for