diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ISnapshotProvider.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ISnapshotProvider.cs index 4646fafb61c..adc5c0b2618 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ISnapshotProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ISnapshotProvider.cs @@ -1,12 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; +using Microsoft.Shared.DiagnosticIds; + namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; /// /// An interface to be implemented by a provider that represents an underlying system and gets resources data about it. /// -internal interface ISnapshotProvider +[Experimental(diagnosticId: DiagnosticIds.Experiments.ResourceMonitoring, UrlFormat = DiagnosticIds.UrlFormat)] +public interface ISnapshotProvider { /// /// Gets the static values of CPU and memory limitations defined by the system. @@ -17,7 +21,5 @@ internal interface ISnapshotProvider /// Get a snapshot of the resource utilization of the system. /// /// An appropriate sample. -#pragma warning disable S4049 // Properties should be preferred Snapshot GetSnapshot(); -#pragma warning restore S4049 // Properties should be preferred } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilization.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilization.cs index 0645f2270bb..ff62aea2218 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilization.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilization.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics.CodeAnalysis; +using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; @@ -41,7 +42,11 @@ public readonly struct ResourceUtilization /// public SystemResources SystemResources { get; } - internal Snapshot Snapshot { get; } = default; + /// + /// Gets the latest snapshot of the resource utilization of the system. + /// + [Experimental(diagnosticId: DiagnosticIds.Experiments.ResourceMonitoring, UrlFormat = DiagnosticIds.UrlFormat)] + public Snapshot Snapshot { get; } = default; /// /// Initializes a new instance of the struct. diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Snapshot.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Snapshot.cs index 8b6fd850cdd..a5955893143 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Snapshot.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Snapshot.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics.CodeAnalysis; +using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; @@ -11,7 +12,8 @@ namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; /// A snapshot of CPU and memory usage taken periodically over time. /// [SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Comparing instances is not an expected scenario")] -internal readonly struct Snapshot +[Experimental(diagnosticId: DiagnosticIds.Experiments.ResourceMonitoring, UrlFormat = DiagnosticIds.UrlFormat)] +public readonly struct Snapshot { /// /// Gets the total CPU time that has elapsed since startup. diff --git a/src/Libraries/Microsoft.Extensions.Options.Contextual/Provider/NullConfigureContextualOptions.cs b/src/Libraries/Microsoft.Extensions.Options.Contextual/Provider/NullConfigureContextualOptions.cs index 3721b4eba7a..dee6602057a 100644 --- a/src/Libraries/Microsoft.Extensions.Options.Contextual/Provider/NullConfigureContextualOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Options.Contextual/Provider/NullConfigureContextualOptions.cs @@ -13,7 +13,6 @@ public static class NullConfigureContextualOptions /// /// The options type to configure. /// A do-nothing instance of . - [System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S4049:Properties should be preferred", Justification = "Not possible for generic methods.")] public static IConfigureContextualOptions GetInstance() where TOptions : class => NullConfigureContextualOptions.Instance;