From 258dd3c068276724cd4ef0e6ad63498b6e7aed03 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:40:41 +0000 Subject: [PATCH 01/10] Initial plan From 88e2ef1a200b1361b37928aebc6152927fbf69ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:47:37 +0000 Subject: [PATCH 02/10] Add documentation for EXTOBS obsolete diagnostics Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../syslib-diagnostics/extobs0001.md | 97 +++++++++++++++++++ .../syslib-diagnostics/extobs0002.md | 89 +++++++++++++++++ .../obsoletions-overview.md | 19 +++- 3 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 docs/fundamentals/syslib-diagnostics/extobs0001.md create mode 100644 docs/fundamentals/syslib-diagnostics/extobs0002.md diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md new file mode 100644 index 0000000000000..13f2ec6b37c55 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -0,0 +1,97 @@ +--- +title: EXTOBS0001 warning +description: Learn about the obsoletions that generate compile-time warning EXTOBS0001. +ms.date: 11/12/2025 +f1_keywords: + - extobs0001 +ai-usage: ai-assisted +--- +# EXTOBS0001: IResourceMonitor is obsolete + +The interface and related APIs have been marked as obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. + +The following APIs are marked obsolete, starting in .NET 9. Use of these APIs generates warning `EXTOBS0001` at compile time. + +- +- + +## Workarounds + +Instead of using `IResourceMonitor`, switch to using resource monitoring metrics with observable instruments. The metrics-based approach provides the same resource utilization information (CPU, memory) but integrates better with modern observability systems like OpenTelemetry. + +### Migration example + +**Old approach using IResourceMonitor:** + +```csharp +services.AddResourceMonitoring(); + +// Inject and use IResourceMonitor +public class MyService +{ + private readonly IResourceMonitor _resourceMonitor; + + public MyService(IResourceMonitor resourceMonitor) + { + _resourceMonitor = resourceMonitor; + } + + public void CheckResources() + { + var utilization = _resourceMonitor.GetUtilization(TimeSpan.FromSeconds(1)); + Console.WriteLine($"CPU: {utilization.CpuUsedPercentage}%"); + Console.WriteLine($"Memory: {utilization.MemoryUsedPercentage}%"); + } +} +``` + +**New approach using metrics:** + +```csharp +services.AddResourceMonitoring(); + +// Configure metrics collection +services.AddOpenTelemetry() + .WithMetrics(builder => + { + builder.AddMeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring"); + builder.AddConsoleExporter(); // Or use any other exporter + }); +``` + +The resource monitoring metrics are automatically published and can be consumed by any OpenTelemetry-compatible metrics pipeline. For more information, see [Resource Monitoring observable instruments](https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics-diagnostics#microsoftextensionsdiagnosticsresourcemonitoring). + +## Suppress a warning + +If you must use the obsolete APIs, you can suppress the warning in code or in your project file. + +To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. + +```csharp +// Disable the warning. +#pragma warning disable EXTOBS0001 + +// Code that uses obsolete API. +// ... + +// Re-enable the warning. +#pragma warning restore EXTOBS0001 +``` + +To suppress all the `EXTOBS0001` warnings in your project, add a `` property to your project file. + +```xml + + + ... + $(NoWarn);EXTOBS0001 + + +``` + +For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings). + +## See also + +- [Diagnostic resource monitoring](../../../core/diagnostics/diagnostic-resource-monitoring.md) +- [Built-in metrics - Resource Monitoring](../../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring) diff --git a/docs/fundamentals/syslib-diagnostics/extobs0002.md b/docs/fundamentals/syslib-diagnostics/extobs0002.md new file mode 100644 index 0000000000000..01ce514222dd1 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/extobs0002.md @@ -0,0 +1,89 @@ +--- +title: EXTOBS0002 warning +description: Learn about the obsoletions that generate compile-time warning EXTOBS0002. +ms.date: 11/12/2025 +f1_keywords: + - extobs0002 +ai-usage: ai-assisted +--- +# EXTOBS0002: AddServiceLogEnricher is obsolete + +The `AddServiceLogEnricher` extension methods have been marked as obsolete. These methods had incorrect naming that didn't accurately reflect their functionality. The methods enrich application logs, not service logs, so they have been replaced with correctly named `AddApplicationLogEnricher` methods. + +The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0002` at compile time. + +- +- +- + +## Workarounds + +Replace calls to `AddServiceLogEnricher` with the equivalent `AddApplicationLogEnricher` methods. The functionality remains the same, only the method names have been corrected to accurately reflect that they enrich application logs. + +### Migration example + +**Old approach using AddServiceLogEnricher:** + +```csharp +services.AddServiceLogEnricher(); + +// Or with configuration: +services.AddServiceLogEnricher(configuration.GetSection("ambientmetadata:application")); + +// Or with options: +services.AddServiceLogEnricher(options => +{ + options.ApplicationName = "MyApp"; +}); +``` + +**New approach using AddApplicationLogEnricher:** + +```csharp +services.AddApplicationLogEnricher(); + +// Or with configuration: +services.AddApplicationLogEnricher(configuration.GetSection("ambientmetadata:application")); + +// Or with options: +services.AddApplicationLogEnricher(options => +{ + options.ApplicationName = "MyApp"; +}); +``` + +For more information, see [Application log enricher](../../../core/enrichment/application-log-enricher.md). + +## Suppress a warning + +If you must use the obsolete APIs, you can suppress the warning in code or in your project file. + +To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. + +```csharp +// Disable the warning. +#pragma warning disable EXTOBS0002 + +// Code that uses obsolete API. +// ... + +// Re-enable the warning. +#pragma warning restore EXTOBS0002 +``` + +To suppress all the `EXTOBS0002` warnings in your project, add a `` property to your project file. + +```xml + + + ... + $(NoWarn);EXTOBS0002 + + +``` + +For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings). + +## See also + +- [Application log enricher](../../../core/enrichment/application-log-enricher.md) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index f6a8f835fbe53..c08524c206c4c 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -13,11 +13,15 @@ Starting in .NET 5, some APIs that are newly marked as obsolete make use of two - The property tells the compiler to include a URL link to learn more about the obsoletion. -If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the [Reference](#reference) section. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). +If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the [Reference](#reference) section. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). ## Reference -The following table provides an index to the `SYSLIB0XXX` obsoletions in .NET 5+. +The following tables provide an index to obsolete APIs with custom diagnostic IDs in .NET 5 and later versions. + +### SYSLIB obsoletions + +The following table lists the `SYSLIB0XXX` obsoletions in .NET 5+. | Diagnostic ID | Warning or error | Description | |---------------|------------------|-------------| @@ -84,9 +88,18 @@ The following table provides an index to the `SYSLIB0XXX` obsoletions in .NET 5+ | [SYSLIB0061](syslib0061.md) | Warning | The `Queryable` and taking an `IComparer` are obsolete. Use the new ones that take an `IComparer`. | | [SYSLIB0062](syslib0062.md) | Warning | is obsolete. | +### EXTOBS obsoletions + +The following table lists the `EXTOBS0XXX` obsoletions from the Microsoft.Extensions libraries. + +| Diagnostic ID | Warning or error | Description | +|---------------|------------------|-------------| +| [EXTOBS0001](extobs0001.md) | Warning | is obsolete and will be removed in a future version. Consider using [Resource Monitoring observable instruments](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring). | +| [EXTOBS0002](extobs0002.md) | Warning | `AddServiceLogEnricher` methods are obsolete and will be removed in a future version. Use the `AddApplicationLogEnricher` methods instead. | + ## Suppress warnings -It's recommended that you use an available workaround whenever possible. However, if you cannot change your code, you can suppress warnings through a `#pragma` directive or a `` project setting. If you must use the obsolete APIs and the `SYSLIB0XXX` diagnostic does not surface as an error, you can suppress the warning in code or in your project file. +It's recommended that you use an available workaround whenever possible. However, if you cannot change your code, you can suppress warnings through a `#pragma` directive or a `` project setting. If you must use the obsolete APIs and the `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic does not surface as an error, you can suppress the warning in code or in your project file. To suppress the warnings in code: From 9c804f04c03d84c9b33c8aaa17e21437425e828a Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 13:57:05 -0800 Subject: [PATCH 03/10] remove second obsoletion for now --- .../syslib-diagnostics/extobs0001.md | 12 +-- .../syslib-diagnostics/extobs0002.md | 89 ------------------- .../obsoletions-overview.md | 13 ++- docs/navigate/tools-diagnostics/toc.yml | 6 +- 4 files changed, 16 insertions(+), 104 deletions(-) delete mode 100644 docs/fundamentals/syslib-diagnostics/extobs0002.md diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md index 13f2ec6b37c55..65879b37c6ac3 100644 --- a/docs/fundamentals/syslib-diagnostics/extobs0001.md +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -10,7 +10,7 @@ ai-usage: ai-assisted The interface and related APIs have been marked as obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. -The following APIs are marked obsolete, starting in .NET 9. Use of these APIs generates warning `EXTOBS0001` at compile time. +The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0001` at compile time. - - @@ -21,7 +21,7 @@ Instead of using `IResourceMonitor`, switch to using resource monitoring metrics ### Migration example -**Old approach using IResourceMonitor:** +Old approach using `IResourceMonitor`: ```csharp services.AddResourceMonitoring(); @@ -45,21 +45,21 @@ public class MyService } ``` -**New approach using metrics:** +New approach using metrics: ```csharp services.AddResourceMonitoring(); -// Configure metrics collection +// Configure metrics collection. services.AddOpenTelemetry() .WithMetrics(builder => { builder.AddMeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring"); - builder.AddConsoleExporter(); // Or use any other exporter + builder.AddConsoleExporter(); // Or use any other exporter. }); ``` -The resource monitoring metrics are automatically published and can be consumed by any OpenTelemetry-compatible metrics pipeline. For more information, see [Resource Monitoring observable instruments](https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics-diagnostics#microsoftextensionsdiagnosticsresourcemonitoring). +The resource monitoring metrics are automatically published and can be consumed by any OpenTelemetry-compatible metrics pipeline. For more information, see [Resource Monitoring observable instruments](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring). ## Suppress a warning diff --git a/docs/fundamentals/syslib-diagnostics/extobs0002.md b/docs/fundamentals/syslib-diagnostics/extobs0002.md deleted file mode 100644 index 01ce514222dd1..0000000000000 --- a/docs/fundamentals/syslib-diagnostics/extobs0002.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: EXTOBS0002 warning -description: Learn about the obsoletions that generate compile-time warning EXTOBS0002. -ms.date: 11/12/2025 -f1_keywords: - - extobs0002 -ai-usage: ai-assisted ---- -# EXTOBS0002: AddServiceLogEnricher is obsolete - -The `AddServiceLogEnricher` extension methods have been marked as obsolete. These methods had incorrect naming that didn't accurately reflect their functionality. The methods enrich application logs, not service logs, so they have been replaced with correctly named `AddApplicationLogEnricher` methods. - -The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0002` at compile time. - -- -- -- - -## Workarounds - -Replace calls to `AddServiceLogEnricher` with the equivalent `AddApplicationLogEnricher` methods. The functionality remains the same, only the method names have been corrected to accurately reflect that they enrich application logs. - -### Migration example - -**Old approach using AddServiceLogEnricher:** - -```csharp -services.AddServiceLogEnricher(); - -// Or with configuration: -services.AddServiceLogEnricher(configuration.GetSection("ambientmetadata:application")); - -// Or with options: -services.AddServiceLogEnricher(options => -{ - options.ApplicationName = "MyApp"; -}); -``` - -**New approach using AddApplicationLogEnricher:** - -```csharp -services.AddApplicationLogEnricher(); - -// Or with configuration: -services.AddApplicationLogEnricher(configuration.GetSection("ambientmetadata:application")); - -// Or with options: -services.AddApplicationLogEnricher(options => -{ - options.ApplicationName = "MyApp"; -}); -``` - -For more information, see [Application log enricher](../../../core/enrichment/application-log-enricher.md). - -## Suppress a warning - -If you must use the obsolete APIs, you can suppress the warning in code or in your project file. - -To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. - -```csharp -// Disable the warning. -#pragma warning disable EXTOBS0002 - -// Code that uses obsolete API. -// ... - -// Re-enable the warning. -#pragma warning restore EXTOBS0002 -``` - -To suppress all the `EXTOBS0002` warnings in your project, add a `` property to your project file. - -```xml - - - ... - $(NoWarn);EXTOBS0002 - - -``` - -For more information, see [Suppress warnings](obsoletions-overview.md#suppress-warnings). - -## See also - -- [Application log enricher](../../../core/enrichment/application-log-enricher.md) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index c08524c206c4c..e975be69ff064 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -1,7 +1,7 @@ --- title: Obsolete features in .NET 5+ description: Learn about APIs that are marked as obsolete in .NET 5 and later versions that produce SYSLIB compiler warnings. -ms.date: 01/14/2025 +ms.date: 11/12/2025 ai-usage: ai-assisted --- @@ -9,8 +9,7 @@ ai-usage: ai-assisted Starting in .NET 5, some APIs that are newly marked as obsolete make use of two new properties on . -- The property tells the compiler to generate build warnings using a custom diagnostic ID. The custom ID allows for obsoletion warning to be suppressed specifically and separately from one another. In the case of the .NET 5+ obsoletions, the format for the custom diagnostic ID is `SYSLIB0XXX`. - +- The property tells the compiler to generate build warnings using a custom diagnostic ID. The custom ID allows for obsoletion warning to be suppressed specifically and separately from one another. In the case of the `System*` namespace obsoletions, the format for the custom diagnostic ID is `SYSLIB0XXX`. In the case of the `Microsoft.Extensions` obsoletions, the format for the custom diagnostic ID is `EXTOBS0XXX`. - The property tells the compiler to include a URL link to learn more about the obsoletion. If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the [Reference](#reference) section. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). @@ -90,12 +89,11 @@ The following table lists the `SYSLIB0XXX` obsoletions in .NET 5+. ### EXTOBS obsoletions -The following table lists the `EXTOBS0XXX` obsoletions from the Microsoft.Extensions libraries. +The following table lists the `EXTOBS0XXX` obsoletions from the `Microsoft.Extensions` libraries. | Diagnostic ID | Warning or error | Description | |---------------|------------------|-------------| | [EXTOBS0001](extobs0001.md) | Warning | is obsolete and will be removed in a future version. Consider using [Resource Monitoring observable instruments](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring). | -| [EXTOBS0002](extobs0002.md) | Warning | `AddServiceLogEnricher` methods are obsolete and will be removed in a future version. Use the `AddApplicationLogEnricher` methods instead. | ## Suppress warnings @@ -136,7 +134,6 @@ To suppress the warnings in a project file: ## See also -- [API obsoletions with non-default diagnostic IDs (.NET 5)](../../core/compatibility/core-libraries/5.0/obsolete-apis-with-custom-diagnostics.md) -- [API obsoletions with non-default diagnostic IDs (.NET 6)](../../core/compatibility/core-libraries/6.0/obsolete-apis-with-custom-diagnostics.md) -- [API obsoletions with non-default diagnostic IDs (.NET 7)](../../core/compatibility/core-libraries/7.0/obsolete-apis-with-custom-diagnostics.md) - [API obsoletions with non-default diagnostic IDs (.NET 8)](../../core/compatibility/core-libraries/8.0/obsolete-apis-with-custom-diagnostics.md) +- [API obsoletions with non-default diagnostic IDs (.NET 9)](../../core/compatibility/core-libraries/9.0/obsolete-apis-with-custom-diagnostics.md) +- [API obsoletions with non-default diagnostic IDs (.NET 10)](../../core/compatibility/core-libraries/10.0/obsolete-apis-with-custom-diagnostics.md) diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index ef7767c738afb..f9a73e90e8b12 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -3936,7 +3936,7 @@ items: - name: Obsoletions items: - name: Overview - displayName: syslib, obsolete, obsoletion + displayName: syslib, extobs, obsolete, obsoletion href: ../../fundamentals/syslib-diagnostics/obsoletions-overview.md - name: SYSLIB0001 href: ../../fundamentals/syslib-diagnostics/syslib0001.md @@ -4170,6 +4170,10 @@ items: - name: SYSLIB1230 href: ../../fundamentals/syslib-diagnostics/syslib1230.md displayProperty: syslib1230, syslib1231, syslib1232, syslib1233, syslib1234, syslib1235, syslib1236, syslib1237, syslib1238, syslib1239 + - name: EXTOBS diagnostics + items: + - name: EXTOBS0001 + href: ../../fundamentals/syslib-diagnostics/extobs0001.md - name: API compatibility items: - name: Overview From b4b80711a83499dc335175779822587be8790fe1 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:07:05 -0800 Subject: [PATCH 04/10] fix warnings --- docs/fundamentals/syslib-diagnostics/extobs0001.md | 6 +++--- .../fundamentals/syslib-diagnostics/obsoletions-overview.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md index 65879b37c6ac3..11055cd41fc42 100644 --- a/docs/fundamentals/syslib-diagnostics/extobs0001.md +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -59,7 +59,7 @@ services.AddOpenTelemetry() }); ``` -The resource monitoring metrics are automatically published and can be consumed by any OpenTelemetry-compatible metrics pipeline. For more information, see [Resource Monitoring observable instruments](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring). +The resource monitoring metrics are automatically published and can be consumed by any OpenTelemetry-compatible metrics pipeline. For more information, see [`Microsoft.Extensions.Diagnostics.ResourceMonitoring` metrics](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring). ## Suppress a warning @@ -93,5 +93,5 @@ For more information, see [Suppress warnings](obsoletions-overview.md#suppress-w ## See also -- [Diagnostic resource monitoring](../../../core/diagnostics/diagnostic-resource-monitoring.md) -- [Built-in metrics - Resource Monitoring](../../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring) +- [Diagnostic resource monitoring](../../core/diagnostics/diagnostic-resource-monitoring.md) +- [`Microsoft.Extensions.Diagnostics.ResourceMonitoring` metrics](../../core/diagnostics/built-in-metrics-diagnostics.md#microsoftextensionsdiagnosticsresourcemonitoring) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index e975be69ff064..a81dfb4e3a7c6 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -136,4 +136,4 @@ To suppress the warnings in a project file: - [API obsoletions with non-default diagnostic IDs (.NET 8)](../../core/compatibility/core-libraries/8.0/obsolete-apis-with-custom-diagnostics.md) - [API obsoletions with non-default diagnostic IDs (.NET 9)](../../core/compatibility/core-libraries/9.0/obsolete-apis-with-custom-diagnostics.md) -- [API obsoletions with non-default diagnostic IDs (.NET 10)](../../core/compatibility/core-libraries/10.0/obsolete-apis-with-custom-diagnostics.md) +- [API obsoletions with non-default diagnostic IDs (.NET 10)](../../core/compatibility/core-libraries/10.0/obsolete-apis.md) From def99c636f0b8f4eeaf35c1d67debd01f97062dc Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:41:17 -0800 Subject: [PATCH 05/10] add other affected apis --- docs/fundamentals/syslib-diagnostics/extobs0001.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md index 11055cd41fc42..1972df181e3bd 100644 --- a/docs/fundamentals/syslib-diagnostics/extobs0001.md +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -13,7 +13,16 @@ The The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0001` at compile time. - -- +- +- +- +- +- +- +- +- +- +- ## Workarounds @@ -55,7 +64,7 @@ services.AddOpenTelemetry() .WithMetrics(builder => { builder.AddMeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring"); - builder.AddConsoleExporter(); // Or use any other exporter. + builder.AddConsoleExporter(); }); ``` From d76771a4c5ab127f8524d9609d36f2d4448fd810 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:55:40 -0800 Subject: [PATCH 06/10] Revise obsoletions overview for clarity and structure Updated the formatting and structure of the obsoletions overview documentation. --- .../syslib-diagnostics/obsoletions-overview.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index a81dfb4e3a7c6..1c51ac956f242 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -14,11 +14,12 @@ Starting in .NET 5, some APIs that are newly marked as obsolete make use of two If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the [Reference](#reference) section. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). -## Reference +The following tables provide an index to obsolete APIs with custom diagnostic IDs in .NET 5 and later versions: -The following tables provide an index to obsolete APIs with custom diagnostic IDs in .NET 5 and later versions. +- [SYSLIB obsoletions](#syslib-obsoletions) +- [EXTOBS obsoletions](#extobs-obsoletions) -### SYSLIB obsoletions +## SYSLIB obsoletions The following table lists the `SYSLIB0XXX` obsoletions in .NET 5+. @@ -87,7 +88,7 @@ The following table lists the `SYSLIB0XXX` obsoletions in .NET 5+. | [SYSLIB0061](syslib0061.md) | Warning | The `Queryable` and taking an `IComparer` are obsolete. Use the new ones that take an `IComparer`. | | [SYSLIB0062](syslib0062.md) | Warning | is obsolete. | -### EXTOBS obsoletions +## EXTOBS obsoletions The following table lists the `EXTOBS0XXX` obsoletions from the `Microsoft.Extensions` libraries. From d55509b484b7fd543a10a6c6f53c51c3735b50d0 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:58:09 -0800 Subject: [PATCH 07/10] Updat display property for xref --- docs/fundamentals/syslib-diagnostics/extobs0001.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md index 1972df181e3bd..437587e46b62a 100644 --- a/docs/fundamentals/syslib-diagnostics/extobs0001.md +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -8,11 +8,11 @@ ai-usage: ai-assisted --- # EXTOBS0001: IResourceMonitor is obsolete -The interface and related APIs have been marked as obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. +The interface and related APIs have been marked as obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0001` at compile time. -- +- - - - From a67ec836528db55df6316f244f9aaa103b10b7e9 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:00:29 -0800 Subject: [PATCH 08/10] Update docs/fundamentals/syslib-diagnostics/obsoletions-overview.md --- docs/fundamentals/syslib-diagnostics/obsoletions-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index 1c51ac956f242..520ac72d6caa7 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -12,7 +12,7 @@ Starting in .NET 5, some APIs that are newly marked as obsolete make use of two - The property tells the compiler to generate build warnings using a custom diagnostic ID. The custom ID allows for obsoletion warning to be suppressed specifically and separately from one another. In the case of the `System*` namespace obsoletions, the format for the custom diagnostic ID is `SYSLIB0XXX`. In the case of the `Microsoft.Extensions` obsoletions, the format for the custom diagnostic ID is `EXTOBS0XXX`. - The property tells the compiler to include a URL link to learn more about the obsoletion. -If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the [Reference](#reference) section. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). +If you encounter build warnings or errors due to usage of an obsolete API, follow the specific guidance provided for the diagnostic ID listed in the reference tables that follow. Warnings or errors for these obsoletions *can't* be suppressed using the [standard diagnostic ID (CS0618)](../../csharp/language-reference/compiler-messages/cs0618.md) for obsolete types or members; use the custom `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic ID values instead. For more information, see [Suppress warnings](#suppress-warnings). The following tables provide an index to obsolete APIs with custom diagnostic IDs in .NET 5 and later versions: From 817ad33cac6e1dd693dff6d5ebf9bc6dd3019bed Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:06:30 -0800 Subject: [PATCH 09/10] Update docs/fundamentals/syslib-diagnostics/obsoletions-overview.md --- docs/fundamentals/syslib-diagnostics/obsoletions-overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md index 520ac72d6caa7..aa8be162264b2 100644 --- a/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md +++ b/docs/fundamentals/syslib-diagnostics/obsoletions-overview.md @@ -98,7 +98,7 @@ The following table lists the `EXTOBS0XXX` obsoletions from the `Microsoft.Exten ## Suppress warnings -It's recommended that you use an available workaround whenever possible. However, if you cannot change your code, you can suppress warnings through a `#pragma` directive or a `` project setting. If you must use the obsolete APIs and the `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic does not surface as an error, you can suppress the warning in code or in your project file. +It's recommended that you use an available workaround whenever possible. However, if you can't change your code, you can suppress warnings through a `#pragma` directive or a `` project setting. If you must use the obsolete APIs, and the `SYSLIB0XXX` or `EXTOBS0XXX` diagnostic doesn't surface as an error, you can suppress the warning in code or in your project file. To suppress the warnings in code: From 9482358c7dc416ac4c6d3fa79829309b2f41a525 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:08:23 -0800 Subject: [PATCH 10/10] Update docs/fundamentals/syslib-diagnostics/extobs0001.md --- docs/fundamentals/syslib-diagnostics/extobs0001.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fundamentals/syslib-diagnostics/extobs0001.md b/docs/fundamentals/syslib-diagnostics/extobs0001.md index 437587e46b62a..3d90b34ddf8f1 100644 --- a/docs/fundamentals/syslib-diagnostics/extobs0001.md +++ b/docs/fundamentals/syslib-diagnostics/extobs0001.md @@ -8,7 +8,7 @@ ai-usage: ai-assisted --- # EXTOBS0001: IResourceMonitor is obsolete -The interface and related APIs have been marked as obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. +The interface and related APIs are obsolete starting in .NET 9. These APIs will be removed in a future version. The resource monitoring functionality has been replaced with a more efficient metrics-based approach using observable instruments. The following APIs are marked obsolete. Use of these APIs generates warning `EXTOBS0001` at compile time.