Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new syslib warnings #23915

Merged
merged 8 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/core/compatibility/syslib-obsoletions.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
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: 10/20/2020
ms.date: 04/23/2021
---
# Obsolete features in .NET 5
# Obsolete features in .NET 5+

Starting in .NET 5, some APIs that are newly marked as obsolete make use of two new properties on <xref:System.ObsoleteAttribute>.

Expand Down Expand Up @@ -31,6 +31,12 @@ The following table provides an index to the `SYSLIBxxxx` obsoletions in .NET 5+
| [SYSLIB0010](syslib-warnings/syslib0010.md) | Some remoting APIs are not supported and throw <xref:System.PlatformNotSupportedException>. |
| [SYSLIB0011](syslib-warnings/syslib0011.md) | <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter> serialization is obsolete and should not be used. |
| [SYSLIB0012](syslib-warnings/syslib0012.md) | <xref:System.Reflection.Assembly.CodeBase?displayProperty=nameWithType> and <xref:System.Reflection.Assembly.EscapedCodeBase?displayProperty=nameWithType> are only included for .NET Framework compatibility. Use <xref:System.Reflection.Assembly.Location?displayProperty=nameWithType> instead. |
| [SYSLIB0013](syslib-warnings/syslib0013.md) | <xref:System.Uri.EscapeUriString(System.String)?displayProperty=nameWithType> can corrupt the Uri string in some cases. Consider using <xref:System.Uri.EscapeDataString(System.String)?displayProperty=nameWithType> for query string components instead. |
| [SYSLIB0014](syslib-warnings/syslib0014.md) | <xref:System.Net.WebRequest>, <xref:System.Net.HttpWebRequest>, <xref:System.Net.ServicePoint>, and <xref:System.Net.WebClient> are obsolete. Use <xref:System.Net.Http.HttpClient> instead. |
| [SYSLIB0015](syslib-warnings/syslib0015.md) | <xref:System.Runtime.CompilerServices.DisablePrivateReflectionAttribute> has no effect in .NET 6+ applications. |
| [SYSLIB0016](syslib-warnings/syslib0016.md) | Use the <xref:System.Drawing.Graphics.GetContextInfo%2A?displayProperty=nameWithType> overloads that accept arguments for better performance and fewer allocations. |
| [SYSLIB0019](syslib-warnings/syslib0019.md) | The <xref:System.Runtime.InteropServices.RuntimeEnvironment?displayProperty=nameWithType> members <xref:System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile>, <xref:System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(System.Guid,System.Guid)>, and <xref:System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsObject(System.Guid,System.Guid)> are no longer supported and throw <xref:System.PlatformNotSupportedException>. |
| [SYSLIB0020](syslib-warnings/syslib0020.md) | <xref:System.Text.Json.JsonSerializerOptions.IgnoreNullValues?displayProperty=nameWithType> is obsolete. To ignore null values when serializing, set <xref:System.Text.Json.JsonSerializerOptions.DefaultIgnoreCondition> to <xref:System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull?displayProperty=nameWithType>. |

## Suppress warnings

Expand Down
17 changes: 17 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0013.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: SYSLIB0013 warning
Copy link
Member

@Youssef1313 Youssef1313 Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://aka.ms/dotnet-warnings/SYSLIB0013 may need to get updated to this article after it's published. (Same applies to other obsoletion warnings.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffhandley I don't seem to have access to these aka.ms links. Can you update for 13-16, 19-20?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will publish these live now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and created the aka.ms links for SYSLIB0017 through SYSLIB0025. I don't (yet) have access to edit the existing ones, but I submitted a request to gain access.

description: Learn about the EscapeUriString obsoletion that generates compile-time warning SYSLIB0013.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0013: EscapeUriString is obsolete

The <xref:System.Uri.EscapeUriString(System.String)?displayProperty=nameWithType> API is marked as obsolete, starting in .NET 6. Using it in code generates warning `SYSLIB0013` at compile time.

<xref:System.Uri.EscapeUriString(System.String)?displayProperty=nameWithType> can corrupt the Uri string in some cases.

## Workarounds

Use <xref:System.Uri.EscapeDataString(System.String)?displayProperty=nameWithType> for query string components instead.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
20 changes: 20 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0014.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: SYSLIB0014 warning
description: Learn about the System.Net obsoletions that generate compile-time warning SYSLIB0014.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0014: WebRequest, HttpWebRequest, ServicePoint, WebClient are obsolete

The following APIs are marked as obsolete, starting in .NET 6. Using them in code generates warning `SYSLIB0014` at compile time.

- <xref:System.Net.WebRequest?displayProperty=fullName>
- <xref:System.Net.HttpWebRequest?displayProperty=fullName>
- <xref:System.Net.ServicePoint?displayProperty=fullName>
- <xref:System.Net.WebClient?displayProperty=fullName>

## Workarounds

Use <xref:System.Net.Http.HttpClient> instead.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
17 changes: 17 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0015.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: SYSLIB0015 warning
description: Learn about the obsoletion of DisablePrivateReflectionAttribute that generates compile-time warning SYSLIB0015.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0015: DisablePrivateReflectionAttribute is obsolete

The <xref:System.Runtime.CompilerServices.DisablePrivateReflectionAttribute?displayProperty=nameWithType> type is marked as obsolete, starting in .NET 6. Using it in code generates warning `SYSLIB0015` at compile time.

<xref:System.Runtime.CompilerServices.DisablePrivateReflectionAttribute> has no effect in .NET 6+ applications.

## Workarounds

None.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
15 changes: 15 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0016.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: SYSLIB0016 warning
description: Learn about the GetContextInfo obsoletion that generates compile-time warning SYSLIB0016.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0016: GetContextInfo() is obsolete

The <xref:System.Drawing.Graphics.GetContextInfo?displayProperty=nameWithType> method that takes no arguments is marked as obsolete, starting in .NET 6. Using it in code generates warning `SYSLIB0016` at compile time.

## Workarounds

Use the <xref:System.Drawing.Graphics.GetContextInfo%2A?displayProperty=nameWithType> overloads that accept arguments for better performance and fewer allocations.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
21 changes: 21 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0019.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: SYSLIB0019 warning
description: Learn about the RuntimeEnvironment obsoletions that generate compile-time warning SYSLIB0019.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0019: Some RuntimeEnvironment APIs are obsolete

The following APIs are marked as obsolete, starting in .NET 6. Using them in code generates warning `SYSLIB0019` at compile time.

- <xref:System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile?displayProperty=nameWithType> property
- <xref:System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(System.Guid,System.Guid)?displayProperty=nameWithType> method
- <xref:System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsObject(System.Guid,System.Guid)?displayProperty=nameWithType> method

These APIs throw a <xref:System.PlatformNotSupportedException> at run time.

## Workarounds

None.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
15 changes: 15 additions & 0 deletions docs/core/compatibility/syslib-warnings/syslib0020.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: SYSLIB0020 warning
description: Learn about the IgnoreNullValues obsoletion that generates compile-time warning SYSLIB0020.
ms.topic: reference
ms.date: 04/24/2021
---
# SYSLIB0020: IgnoreNullValues is obsolete

The <xref:System.Text.Json.JsonSerializerOptions.IgnoreNullValues?displayProperty=nameWithType> property is marked as obsolete, starting in .NET 6. Using it in code generates warning `SYSLIB0020` at compile time.

## Workarounds

To ignore null values when serializing, set <xref:System.Text.Json.JsonSerializerOptions.DefaultIgnoreCondition> to <xref:System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull?displayProperty=nameWithType>.

[!INCLUDE [suppress-syslib-warning](../../../../includes/suppress-syslib-warning.md)]
12 changes: 12 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,15 @@ items:
href: syslib-warnings/syslib0011.md
- name: SYSLIB0012
href: syslib-warnings/syslib0012.md
- name: SYSLIB0013
href: syslib-warnings/syslib0013.md
- name: SYSLIB0014
href: syslib-warnings/syslib0014.md
- name: SYSLIB0015
href: syslib-warnings/syslib0015.md
- name: SYSLIB0016
href: syslib-warnings/syslib0016.md
- name: SYSLIB0019
href: syslib-warnings/syslib0019.md
- name: SYSLIB0020
href: syslib-warnings/syslib0020.md