diff --git a/eng/Versions.props b/eng/Versions.props index 2b8c760f5b09..8dab489b9baa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -158,7 +158,7 @@ - 3.8.0-5.20519.18 + 3.10.0-1.final 5.0.0-preview.4.20180.4 diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index c66ca69e214f..459cce22c1ad 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -1,6 +1,7 @@ #nullable enable *REMOVED*static Microsoft.AspNetCore.Components.ParameterView.FromDictionary(System.Collections.Generic.IDictionary! parameters) -> Microsoft.AspNetCore.Components.ParameterView *REMOVED*virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.RenderTree.EventFieldInfo! fieldInfo, System.EventArgs! eventArgs) -> System.Threading.Tasks.Task! +*REMOVED*readonly Microsoft.AspNetCore.Components.RenderTree.RenderTreeEdit.RemovedAttributeName -> string! Microsoft.AspNetCore.Components.ComponentApplicationState Microsoft.AspNetCore.Components.ComponentApplicationState.OnPersisting -> Microsoft.AspNetCore.Components.ComponentApplicationState.OnPersistingCallback! Microsoft.AspNetCore.Components.ComponentApplicationState.OnPersistingCallback @@ -35,4 +36,4 @@ Microsoft.AspNetCore.Components.RenderTree.Renderer.GetEventArgsType(ulong event override Microsoft.AspNetCore.Components.LayoutComponentBase.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) -> System.Threading.Tasks.Task! static Microsoft.AspNetCore.Components.ParameterView.FromDictionary(System.Collections.Generic.IDictionary! parameters) -> Microsoft.AspNetCore.Components.ParameterView virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.RenderTree.EventFieldInfo? fieldInfo, System.EventArgs! eventArgs) -> System.Threading.Tasks.Task! -*REMOVED*readonly Microsoft.AspNetCore.Components.RenderTree.RenderTreeEdit.RemovedAttributeName -> string +readonly Microsoft.AspNetCore.Components.RenderTree.RenderTreeEdit.RemovedAttributeName -> string? diff --git a/src/Components/Components/src/RenderTree/RenderTreeEdit.cs b/src/Components/Components/src/RenderTree/RenderTreeEdit.cs index 93b1dd9da605..1188fb63fb1d 100644 --- a/src/Components/Components/src/RenderTree/RenderTreeEdit.cs +++ b/src/Components/Components/src/RenderTree/RenderTreeEdit.cs @@ -48,7 +48,7 @@ public readonly struct RenderTreeEdit /// If the value is , /// gets the name of the attribute that is being removed. /// - [FieldOffset(16)] public readonly string RemovedAttributeName; + [FieldOffset(16)] public readonly string? RemovedAttributeName; private RenderTreeEdit(RenderTreeEditType type) : this() { diff --git a/src/Components/Ignitor/src/ElementHive.cs b/src/Components/Ignitor/src/ElementHive.cs index 07e551c870bf..6d9949e81040 100644 --- a/src/Components/Ignitor/src/ElementHive.cs +++ b/src/Components/Ignitor/src/ElementHive.cs @@ -149,7 +149,7 @@ private void ApplyEdits(RenderBatch batch, ContainerNode parent, int childIndex, var node = parent.Children[childIndexAtCurrentDepth + siblingIndex]; if (node is ElementNode element) { - var attributeName = edit.RemovedAttributeName; + var attributeName = edit.RemovedAttributeName!; // First try to remove any special property we use for this attribute if (!TryApplySpecialProperty(batch, element, attributeName, default)) diff --git a/src/DataProtection/DataProtection/src/KeyManagement/IKeyManager.cs b/src/DataProtection/DataProtection/src/KeyManagement/IKeyManager.cs index 6debf4ac960b..7f840803ecf4 100644 --- a/src/DataProtection/DataProtection/src/KeyManagement/IKeyManager.cs +++ b/src/DataProtection/DataProtection/src/KeyManagement/IKeyManager.cs @@ -59,7 +59,7 @@ public interface IKeyManager /// This method will not mutate existing IKey instances. After calling this method, /// all existing IKey instances should be discarded, and GetAllKeys should be called again. /// - void RevokeKey(Guid keyId, string reason = null); + void RevokeKey(Guid keyId, string? reason = null); /// /// Revokes all keys created before a specified date and persists the revocation to the @@ -72,6 +72,6 @@ public interface IKeyManager /// This method will not mutate existing IKey instances. After calling this method, /// all existing IKey instances should be discarded, and GetAllKeys should be called again. /// - void RevokeAllKeys(DateTimeOffset revocationDate, string reason = null); + void RevokeAllKeys(DateTimeOffset revocationDate, string? reason = null); } } diff --git a/src/DataProtection/DataProtection/src/Managed/ManagedAuthenticatedEncryptor.cs b/src/DataProtection/DataProtection/src/Managed/ManagedAuthenticatedEncryptor.cs index c4a3f63361ff..d9c806fa362c 100644 --- a/src/DataProtection/DataProtection/src/Managed/ManagedAuthenticatedEncryptor.cs +++ b/src/DataProtection/DataProtection/src/Managed/ManagedAuthenticatedEncryptor.cs @@ -229,12 +229,12 @@ public byte[] Decrypt(ArraySegment protectedPayload, ArraySegment ad macOffset = eofOffset - _validationAlgorithmDigestLengthInBytes; } - correctHash = hashAlgorithm.ComputeHash(protectedPayload.Array, ivOffset, macOffset - ivOffset); + correctHash = hashAlgorithm.ComputeHash(protectedPayload.Array!, ivOffset, macOffset - ivOffset); } // Step 4: Validate the MAC provided as part of the payload. - if (!CryptoUtil.TimeConstantBuffersAreEqual(correctHash, 0, correctHash.Length, protectedPayload.Array, macOffset, eofOffset - macOffset)) + if (!CryptoUtil.TimeConstantBuffersAreEqual(correctHash, 0, correctHash.Length, protectedPayload.Array!, macOffset, eofOffset - macOffset)) { throw Error.CryptCommon_PayloadInvalid(); // integrity check failure } @@ -247,7 +247,7 @@ public byte[] Decrypt(ArraySegment protectedPayload, ArraySegment ad var outputStream = new MemoryStream(); using (var cryptoStream = new CryptoStream(outputStream, cryptoTransform, CryptoStreamMode.Write)) { - cryptoStream.Write(protectedPayload.Array, ciphertextOffset, macOffset - ciphertextOffset); + cryptoStream.Write(protectedPayload.Array!, ciphertextOffset, macOffset - ciphertextOffset); cryptoStream.FlushFinalBlock(); // At this point, outputStream := { plaintext }, and we're done! @@ -349,7 +349,7 @@ public byte[] Encrypt(ArraySegment plaintext, ArraySegment additiona var mac = validationAlgorithm.ComputeHash(underlyingBuffer, KEY_MODIFIER_SIZE_IN_BYTES, checked((int)outputStream.Length - KEY_MODIFIER_SIZE_IN_BYTES)); outputStream.Write(mac, 0, mac.Length); - // At this point, outputStream := { keyModifier || IV || ciphertext || MAC(IV || ciphertext) } + // At this point, outputStream := { keyModifier || IV || ciphertext || MAC(IV || ciphertext) } // And we're done! return outputStream.ToArray(); } diff --git a/src/DataProtection/DataProtection/src/PublicAPI.Unshipped.txt b/src/DataProtection/DataProtection/src/PublicAPI.Unshipped.txt index e042bb2e5128..e5609ec9a64b 100644 --- a/src/DataProtection/DataProtection/src/PublicAPI.Unshipped.txt +++ b/src/DataProtection/DataProtection/src/PublicAPI.Unshipped.txt @@ -28,6 +28,8 @@ *REMOVED*static Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.DefaultKeyStorageDirectory.get -> System.IO.DirectoryInfo! *REMOVED*static Microsoft.AspNetCore.DataProtection.Repositories.RegistryXmlRepository.DefaultRegistryKey.get -> Microsoft.Win32.RegistryKey! *REMOVED*virtual Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver.ResolveCertificate(string! thumbprint) -> System.Security.Cryptography.X509Certificates.X509Certificate2! +*REMOVED*Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager.RevokeAllKeys(System.DateTimeOffset revocationDate, string! reason = null) -> void +*REMOVED*Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager.RevokeKey(System.Guid keyId, string! reason = null) -> void Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptorFactory.CreateEncryptorInstance(Microsoft.AspNetCore.DataProtection.KeyManagement.IKey! key) -> Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor? Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory.CreateEncryptorInstance(Microsoft.AspNetCore.DataProtection.KeyManagement.IKey! key) -> Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor? Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance(Microsoft.AspNetCore.DataProtection.KeyManagement.IKey! key) -> Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor? @@ -38,6 +40,8 @@ Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryp Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptorFactory.CreateEncryptorInstance(Microsoft.AspNetCore.DataProtection.KeyManagement.IKey! key) -> Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor? Microsoft.AspNetCore.DataProtection.DataProtectionOptions.ApplicationDiscriminator.get -> string? Microsoft.AspNetCore.DataProtection.KeyManagement.IKey.CreateEncryptor() -> Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor? +Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager.RevokeAllKeys(System.DateTimeOffset revocationDate, string? reason = null) -> void +Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager.RevokeKey(System.Guid keyId, string? reason = null) -> void Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.DefaultKeyResolution.DefaultKey -> Microsoft.AspNetCore.DataProtection.KeyManagement.IKey? Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.DefaultKeyResolution.FallbackKey -> Microsoft.AspNetCore.DataProtection.KeyManagement.IKey? Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.RevokeSingleKey(System.Guid keyId, System.DateTimeOffset revocationDate, string? reason) -> void @@ -56,4 +60,4 @@ Microsoft.AspNetCore.DataProtection.XmlEncryption.NullXmlEncryptor.NullXmlEncryp static Microsoft.AspNetCore.DataProtection.DataProtectionUtilityExtensions.GetApplicationUniqueIdentifier(this System.IServiceProvider! services) -> string? static Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.DefaultKeyStorageDirectory.get -> System.IO.DirectoryInfo? static Microsoft.AspNetCore.DataProtection.Repositories.RegistryXmlRepository.DefaultRegistryKey.get -> Microsoft.Win32.RegistryKey? -virtual Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver.ResolveCertificate(string! thumbprint) -> System.Security.Cryptography.X509Certificates.X509Certificate2? \ No newline at end of file +virtual Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver.ResolveCertificate(string! thumbprint) -> System.Security.Cryptography.X509Certificates.X509Certificate2? diff --git a/src/Hosting/TestHost/src/TestWebSocket.cs b/src/Hosting/TestHost/src/TestWebSocket.cs index 027620ebe55b..a4e1b91f8462 100644 --- a/src/Hosting/TestHost/src/TestWebSocket.cs +++ b/src/Hosting/TestHost/src/TestWebSocket.cs @@ -118,7 +118,7 @@ public override async Task ReceiveAsync(ArraySegment ReceiveAsync(ArraySegment(receiveMessage.Buffer.Array, receiveMessage.Buffer.Offset + count, receiveMessage.Buffer.Count - count); + receiveMessage.Buffer = new ArraySegment(receiveMessage.Buffer.Array!, receiveMessage.Buffer.Offset + count, receiveMessage.Buffer.Count - count); _receiveMessage = receiveMessage; } endOfMessage = endOfMessage && receiveMessage.EndOfMessage; @@ -257,7 +257,7 @@ private class ReceiverSenderBuffer private bool _disposed; private readonly SemaphoreSlim _sem; private readonly Queue _messageQueue; - + public ReceiverSenderBuffer() { _sem = new SemaphoreSlim(0); diff --git a/src/Http/Headers/src/BaseHeaderParser.cs b/src/Http/Headers/src/BaseHeaderParser.cs index 9400a13aef46..ddfc0289e3c9 100644 --- a/src/Http/Headers/src/BaseHeaderParser.cs +++ b/src/Http/Headers/src/BaseHeaderParser.cs @@ -46,8 +46,7 @@ public sealed override bool TryParseValue(StringSegment value, ref int index, ou return SupportsMultipleValues; } - T result; - var length = GetParsedValueLength(value, current, out result); + var length = GetParsedValueLength(value, current, out var result); if (length == 0) { diff --git a/src/Http/Headers/src/HttpHeaderParser.cs b/src/Http/Headers/src/HttpHeaderParser.cs index 942b470680a2..5e549f89c219 100644 --- a/src/Http/Headers/src/HttpHeaderParser.cs +++ b/src/Http/Headers/src/HttpHeaderParser.cs @@ -38,8 +38,7 @@ public bool SupportsMultipleValues // If a parser returns 'null', it means there was no value, but that's valid (e.g. "Accept: "). The caller // can ignore the value. - T result; - if (!TryParseValue(value, ref index, out result)) + if (!TryParseValue(value, ref index, out var result)) { throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The header contains invalid values at index {0}: '{1}'", index, value.Value ?? "")); @@ -75,15 +74,14 @@ protected virtual bool TryParseValues(IList? values, bool strict, [NotNu while (!string.IsNullOrEmpty(value) && index < value.Length) { - T output; - if (TryParseValue(value, ref index, out output)) + if (TryParseValue(value, ref index, out var output)) { // The entry may not contain an actual value, like " , " if (output != null) { if (results == null) { - results = new List(); // Allocate it only when used + results = new List(); // Allocate it only when used } results.Add(output); } @@ -133,8 +131,7 @@ protected virtual IList ParseValues(IList? values, bool strict) while (!string.IsNullOrEmpty(value) && index < value.Length) { - T output; - if (TryParseValue(value, ref index, out output)) + if (TryParseValue(value, ref index, out var output)) { // The entry may not contain an actual value, like " , " if (output != null) diff --git a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/TaskGenericsUtil.cs b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/TaskGenericsUtil.cs index 09e5c237ce46..b5bf93724b77 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/TaskGenericsUtil.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/TaskGenericsUtil.cs @@ -91,7 +91,7 @@ public void SetResult(object tcs, object? result) // If necessary, attempt a cast var typedResult = result is T resultT ? resultT - : (T)Convert.ChangeType(result, typeof(T), CultureInfo.InvariantCulture); + : (T)Convert.ChangeType(result, typeof(T), CultureInfo.InvariantCulture)!; typedTcs.SetResult(typedResult!); } diff --git a/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs b/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs index 1b4fb23dacda..7d3505ee7408 100644 --- a/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs +++ b/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs @@ -2298,7 +2298,9 @@ public async Task Validation_InifnitelyRecursiveModel_ValidationOnTopLevelParame private static void Validation_InifnitelyRecursiveModel_ValidationOnTopLevelParameterMethod([Required] RecursiveModel model) { } +#pragma warning disable CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? private record RecordTypeWithValidatorsOnProperties(string Property1) +#pragma warning restore CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? { [Required] public string Property1 { get; init; } @@ -2335,7 +2337,9 @@ public async Task Validation_ValidatorsDefinedOnRecordTypeProperties() Assert.Equal(expected, ex.Message); } +#pragma warning disable CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? private record RecordTypeWithValidatorsOnPropertiesAndParameters([Required] string Property1) +#pragma warning restore CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? { [Required] public string Property1 { get; init; } @@ -2372,7 +2376,9 @@ public async Task Validation_ValidatorsDefinedOnRecordTypePropertiesAndParameter Assert.Equal(expected, ex.Message); } +#pragma warning disable CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? private record RecordTypeWithValidatorsOnMixOfPropertiesAndParameters([Required] string Property1, string Property2) +#pragma warning restore CS8907 // Parameter is unread. Did you forget to use it to initialize the property with that name? { [Required] public string Property2 { get; init; }