Las anotaciones en los tipos de referencia que aceptan valores NULL han cambiado.
A partir de ASP.NET Core 5.0, las anotaciones de nulabilidad se han aplicado a partes del código. Desde el principio de este esfuerzo, se esperaban errores en estas anotaciones y es necesario realizar correcciones. En ASP.NET Core 6.0, se están actualizando algunas anotaciones aplicadas previamente. Algunos de estos cambios se consideran cambios importantes en el origen. Los cambios conducen a que las API sean incompatibles o más restrictivas. Las API actualizadas pueden producir advertencias en tiempo de compilación cuando se usan en proyectos que tienen habilitados los tipos de referencia que aceptan valores NULL.
Para obtener información, vea la incidencia de GitHub dotnet/aspnetcore#27564.
Versión introducida
ASP.NET Core 6.0
Comportamiento anterior
Las API afectadas tienen anotaciones de tipo de referencia que aceptan valores NULL incorrectas. Las advertencias de compilación faltan o son incorrectas.
Comportamiento nuevo
Se generan nuevas advertencias de compilación. Ya no se generan advertencias de compilación incorrectas para las API afectadas.
Motivo del cambio
Gracias a comentarios y pruebas adicionales, se ha determinado que las anotaciones que aceptan valores NULL de las API afectadas eran inexactas. Las anotaciones actualizadas representan ahora correctamente los contratos de nulabilidad de las API.
Acción recomendada
Actualice el código que llama a estas API para reflejar los contratos de nulabilidad revisados.
API afectadas
- 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)
Vea también
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de