diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs index 8934fef1b9d..746909d1b8c 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.AsyncState; @@ -12,7 +10,6 @@ namespace Microsoft.Extensions.AsyncState; /// /// The type of the asynchronous state. /// This type is intended for internal use. Use instead. -[Experimental(diagnosticId: DiagnosticIds.Experiments.AsyncState, UrlFormat = DiagnosticIds.UrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] #pragma warning disable S4023 // Interfaces should not be empty public interface IAsyncLocalContext : IAsyncContext diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs index 0f76e3a9c00..47352c849aa 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs @@ -17,7 +17,10 @@ namespace Microsoft.Extensions.Compliance.Redaction; -internal sealed class HmacRedactor : Redactor +/// +/// A redactor using HMACSHA256 to encode data being redacted. +/// +public sealed class HmacRedactor : Redactor { #if NET6_0_OR_GREATER private const int SHA256HashSizeInBytes = 32; @@ -33,18 +36,23 @@ internal sealed class HmacRedactor : Redactor private readonly byte[] _hashKey; private readonly string _keyId; + /// + /// Initializes a new instance of the class. + /// + /// Controls the behavior of the redactor. public HmacRedactor(IOptions options) { - var value = Throw.IfMemberNull(options, options.Value); + var value = Throw.IfMemberNull(options, options?.Value); _hashKey = Convert.FromBase64String(value.Key); _keyId = value.KeyId.HasValue ? value.KeyId.Value.ToInvariantString() + ':' : string.Empty; _redactedLength = Base64HashLength + _keyId.Length; } - public override int GetRedactedLength(ReadOnlySpan source) + /// + public override int GetRedactedLength(ReadOnlySpan input) { - if (source.IsEmpty) + if (input.IsEmpty) { return 0; } @@ -53,6 +61,7 @@ public override int GetRedactedLength(ReadOnlySpan source) } #if NET6_0_OR_GREATER + /// public override int Redact(ReadOnlySpan source, Span destination) { var length = GetRedactedLength(source); @@ -82,6 +91,7 @@ private static int CreateSha256Hash(ReadOnlySpan source, Span destin #else + /// public override int Redact(ReadOnlySpan source, Span destination) { const int RemainingBytesToPadForBase64Hash = BytesOfHashWeUse % 3; diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs index a66b6aefd47..1a110339ad1 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs @@ -2,14 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.Compliance.Redaction; /// -/// A redactor using HMACSHA256 to encode data being redacted. +/// Options to control the . /// -[Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] public class HmacRedactorOptions { /// diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json index 88f44e26362..7c646a7e9b1 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json @@ -1,5 +1,5 @@ { - "Name": "Microsoft.Extensions.Compliance.Redaction, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", + "Name": "Microsoft.Extensions.Compliance.Redaction, Version=8.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "Types": [ { "Type": "sealed class Microsoft.Extensions.Compliance.Redaction.ErasingRedactor : Microsoft.Extensions.Compliance.Redaction.Redactor", @@ -25,23 +25,41 @@ } ] }, + { + "Type": "sealed class Microsoft.Extensions.Compliance.Redaction.HmacRedactor : Microsoft.Extensions.Compliance.Redaction.Redactor", + "Stage": "Stable", + "Methods": [ + { + "Member": "Microsoft.Extensions.Compliance.Redaction.HmacRedactor.HmacRedactor(Microsoft.Extensions.Options.IOptions options);", + "Stage": "Stable" + }, + { + "Member": "override int Microsoft.Extensions.Compliance.Redaction.HmacRedactor.GetRedactedLength(System.ReadOnlySpan input);", + "Stage": "Stable" + }, + { + "Member": "override int Microsoft.Extensions.Compliance.Redaction.HmacRedactor.Redact(System.ReadOnlySpan source, System.Span destination);", + "Stage": "Stable" + } + ] + }, { "Type": "class Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions", - "Stage": "Experimental", + "Stage": "Stable", "Methods": [ { "Member": "Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.HmacRedactorOptions();", - "Stage": "Experimental" + "Stage": "Stable" } ], "Properties": [ { "Member": "string Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.Key { get; set; }", - "Stage": "Experimental" + "Stage": "Stable" }, { "Member": "int? Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.KeyId { get; set; }", - "Stage": "Experimental" + "Stage": "Stable" } ] }, @@ -51,11 +69,11 @@ "Methods": [ { "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionExtensions.SetHmacRedactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, System.Action configure, params Microsoft.Extensions.Compliance.Classification.DataClassificationSet[] classifications);", - "Stage": "Experimental" + "Stage": "Stable" }, { "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionExtensions.SetHmacRedactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, Microsoft.Extensions.Configuration.IConfigurationSection section, params Microsoft.Extensions.Compliance.Classification.DataClassificationSet[] classifications);", - "Stage": "Experimental" + "Stage": "Stable" } ] }, diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs index e3bee7e2605..191d8af6f55 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Compliance.Redaction; @@ -24,7 +23,6 @@ public static class RedactionExtensions /// The data classifications for which the redactor type should be used. /// The value of . /// , , or is . - [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, Action configure, params DataClassificationSet[] classifications) { _ = Throw.IfNull(builder); @@ -47,7 +45,6 @@ public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, /// The data classifications for which the redactor type should be used. /// The value of . /// , , or is . - [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HmacRedactorOptions))] [UnconditionalSuppressMessage( "Trimming", diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs index e9828cff6a0..8a3b184732d 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; -using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Logging.Testing; @@ -77,7 +75,6 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep /// The value associated with the key, or if the key was not found. If the structured /// state contains multiple entries with the same key, the value associated with the first matching key encountered is returned. /// - [Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] public string? GetStructuredStateValue(string key) { if (StructuredState is not null) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json index 4432a3ca1c5..b2e7a70ed15 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json @@ -1,5 +1,5 @@ { - "Name": "Microsoft.Extensions.Diagnostics.Testing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", + "Name": "Microsoft.Extensions.Diagnostics.Testing, Version=8.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "Types": [ { "Type": "sealed class Microsoft.Extensions.Diagnostics.Metrics.Testing.CollectedMeasurement where T : struct", @@ -257,6 +257,10 @@ "Member": "Microsoft.Extensions.Logging.Testing.FakeLogRecord.FakeLogRecord(Microsoft.Extensions.Logging.LogLevel level, Microsoft.Extensions.Logging.EventId id, object? state, System.Exception? exception, string message, System.Collections.Generic.IReadOnlyList scopes, string? category, bool enabled, System.DateTimeOffset timestamp);", "Stage": "Stable" }, + { + "Member": "string? Microsoft.Extensions.Logging.Testing.FakeLogRecord.GetStructuredStateValue(string key);", + "Stage": "Stable" + }, { "Member": "override string Microsoft.Extensions.Logging.Testing.FakeLogRecord.ToString();", "Stage": "Stable"