Skip to content

Commit ba410b5

Browse files
committed
Update local copy of ExperimentalAttribute per dotnet/runtime#85444
1 parent 0bd383e commit ba410b5

File tree

74 files changed

+137
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+137
-132
lines changed

Directory.Build.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
</Target>
6767

6868
<ItemGroup Condition="'$(Stage)' == 'dev' AND '$(OutputType)' != 'Exe' AND '$(Api)' != 'false'">
69-
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExperimentalAttribute" />
69+
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExperimentalAttribute">
70+
<_Parameter1>TBD</_Parameter1>
71+
</AssemblyAttribute>
7072
</ItemGroup>
7173

7274
<Target Name="AddInternalsVisibleToDynamicProxyGenAssembly2" BeforeTargets="BeforeCompile">
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
#if !NET8_0_OR_GREATER
5+
46
namespace System.Diagnostics.CodeAnalysis;
57

68
/// <summary>
@@ -24,30 +26,31 @@ internal sealed class ExperimentalAttribute : Attribute
2426
/// <summary>
2527
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class.
2628
/// </summary>
27-
public ExperimentalAttribute()
29+
/// <param name="diagnosticId">Human readable explanation for marking experimental API.</param>
30+
public ExperimentalAttribute(string diagnosticId)
2831
{
29-
// Intentionally left empty.
32+
DiagnosticId = diagnosticId;
3033
}
3134

3235
/// <summary>
33-
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class.
36+
/// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to.
3437
/// </summary>
35-
/// <param name="message">Human readable explanation for marking experimental API.</param>
36-
public ExperimentalAttribute(string message)
37-
{
38-
#pragma warning disable R9A014 // Use the 'Microsoft.Extensions.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance
39-
#pragma warning disable R9A039 // Remove superfluous null check when compiling in a nullable context
40-
#pragma warning disable R9A060 // Consider removing unnecessary null coalescing (??) since the left-hand value is statically known not to be null
41-
#pragma warning disable SA1101 // Prefix local calls with this
42-
Message = message ?? throw new ArgumentNullException(nameof(message));
43-
#pragma warning restore SA1101 // Prefix local calls with this
44-
#pragma warning restore R9A060 // Consider removing unnecessary null coalescing (??) since the left-hand value is statically known not to be null
45-
#pragma warning restore R9A039 // Remove superfluous null check when compiling in a nullable context
46-
#pragma warning restore R9A014 // Use the 'Microsoft.Extensions.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance
47-
}
38+
/// <value>The unique diagnostic ID.</value>
39+
/// <remarks>
40+
/// The diagnostic ID is shown in build output for warnings and errors.
41+
/// <para>This property represents the unique ID that can be used to suppress the warnings or errors, if needed.</para>
42+
/// </remarks>
43+
public string DiagnosticId { get; }
4844

4945
/// <summary>
50-
/// Gets a human readable explanation for marking API as experimental.
46+
/// Gets or sets the URL for corresponding documentation.
47+
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
5148
/// </summary>
52-
public string? Message { get; }
49+
/// <value>The format string that represents a URL to corresponding documentation.</value>
50+
/// <remarks>An example format string is <c>https://contoso.com/obsoletion-warnings/{0}</c>.</remarks>
51+
#pragma warning disable S3996 // URI properties should not be strings
52+
public string? UrlFormat { get; set; }
53+
#pragma warning restore S3996 // URI properties should not be strings
5354
}
55+
56+
#endif

src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/LoggingOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class LoggingOptions
6767
/// <value>
6868
/// The default value is <see cref="HttpRouteParameterRedactionMode.Strict"/>.
6969
/// </value>
70-
[Experimental]
70+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
7171
public HttpRouteParameterRedactionMode RequestPathParameterRedactionMode { get; set; } = DefaultPathParameterRedactionMode;
7272

7373
/// <summary>
@@ -208,7 +208,7 @@ public class LoggingOptions
208208
/// };
209209
/// </code>
210210
/// </example>
211-
[Experimental]
211+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
212212
[Required]
213213
[SuppressMessage("Usage", "CA2227:Collection properties should be read only",
214214
Justification = "Options pattern.")]

src/Libraries/Microsoft.AspNetCore.Telemetry/Enrichment.RequestHeaders/RequestHeadersLogEnricherOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class RequestHeadersLogEnricherOptions
2020
/// Default value is an empty dictionary.
2121
/// </remarks>
2222
[Required]
23-
[Experimental]
23+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
2424
#pragma warning disable CA2227 // Collection properties should be read only
2525
public IDictionary<string, DataClassification> HeadersDataClasses { get; set; } = new Dictionary<string, DataClassification>();
2626
#pragma warning restore CA2227 // Collection properties should be read only

src/Libraries/Microsoft.AspNetCore.Telemetry/Tracing/HttpTracingExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static TracerProviderBuilder AddHttpTraceEnricher(this TracerProviderBuil
116116
/// <param name="services">The <see cref="IServiceCollection"/> to add this enricher.</param>
117117
/// <returns><see cref="IServiceCollection"/> for chaining.</returns>
118118
/// <exception cref="ArgumentNullException">The argument <paramref name="services"/> is <see langword="null"/>.</exception>
119-
[Experimental]
119+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
120120
public static IServiceCollection AddHttpTraceEnricher<T>(this IServiceCollection services)
121121
where T : class, IHttpTraceEnricher
122122
{
@@ -132,7 +132,7 @@ public static IServiceCollection AddHttpTraceEnricher<T>(this IServiceCollection
132132
/// <param name="enricher">Enricher to be added.</param>
133133
/// <returns><see cref="TracerProviderBuilder"/> for chaining.</returns>
134134
/// <exception cref="ArgumentNullException">The argument <paramref name="services"/> or <paramref name="enricher"/> is <see langword="null" />.</exception>
135-
[Experimental]
135+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
136136
public static IServiceCollection AddHttpTraceEnricher(this IServiceCollection services, IHttpTraceEnricher enricher)
137137
{
138138
_ = Throw.IfNull(services);

src/Libraries/Microsoft.AspNetCore.Telemetry/Tracing/HttpTracingOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class HttpTracingOptions
5151
/// <remarks>
5252
/// This property is applicable when the <see cref="IncludePath"/> option is enabled.
5353
/// </remarks>
54-
[Experimental]
54+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
5555
public HttpRouteParameterRedactionMode RequestPathParameterRedactionMode { get; set; } = DefaultPathParameterRedactionMode;
5656

5757
/// <summary>

src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.Extensions.AsyncState;
1111
/// </summary>
1212
/// <typeparam name="T">The type of the asynchronous state.</typeparam>
1313
/// <remarks>This type is intended for internal use. Use <see cref="IAsyncContext{T}"/> instead.</remarks>
14-
[Experimental]
14+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
1515
[EditorBrowsable(EditorBrowsableState.Never)]
1616
#pragma warning disable S4023 // Interfaces should not be empty
1717
public interface IAsyncLocalContext<T> : IAsyncContext<T>

src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/CommonHealthChecksExtensions.TelemetryPublisher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static IServiceCollection AddTelemetryHealthCheckPublisher(this IServiceC
3030
/// <param name="section">Configuration for <see cref="TelemetryHealthCheckPublisherOptions"/>.</param>
3131
/// <returns>The value of <paramref name="services"/>.</returns>
3232
/// <exception cref="ArgumentNullException"><paramref name="services" /> or <paramref name="section"/> are <see langword="null" />.</exception>
33-
[Experimental]
33+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
3434
public static IServiceCollection AddTelemetryHealthCheckPublisher(this IServiceCollection services, IConfigurationSection section)
3535
=> Throw.IfNull(services)
3636
.Configure<TelemetryHealthCheckPublisherOptions>(Throw.IfNull(section))
@@ -44,7 +44,7 @@ public static IServiceCollection AddTelemetryHealthCheckPublisher(this IServiceC
4444
/// <param name="configure">Configuration for <see cref="TelemetryHealthCheckPublisherOptions"/>.</param>
4545
/// <returns>The value of <paramref name="services"/>.</returns>
4646
/// <exception cref="ArgumentNullException"><paramref name="services" /> or <paramref name="configure"/> are <see langword="null" />.</exception>
47-
[Experimental]
47+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
4848
public static IServiceCollection AddTelemetryHealthCheckPublisher(this IServiceCollection services, Action<TelemetryHealthCheckPublisherOptions> configure)
4949
=> Throw.IfNull(services)
5050
.Configure(Throw.IfNull(configure))

src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/TelemetryHealthCheckPublisherOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks;
88
/// <summary>
99
/// Options for the telemetry health check publisher.
1010
/// </summary>
11-
[Experimental]
11+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
1212
public class TelemetryHealthCheckPublisherOptions
1313
{
1414
/// <summary>

src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ResourceMonitoringOptions
5050
/// The value needs to be less than or equal to the <see cref="CollectionWindow"/>.
5151
/// Most importantly, this period is used to calculate <see cref="Utilization"/> instances pushed to publishers.
5252
/// </remarks>
53-
[Experimental]
53+
[Experimental(diagnosticId: "TBD", UrlFormat = "TBD")]
5454
[TimeSpan(MinimumSamplingWindow, MaximumSamplingWindow)]
5555
public TimeSpan CalculationPeriod { get; set; } = DefaultCollectionWindow;
5656
}

0 commit comments

Comments
 (0)