[Breaking change]: ServicePointManager is fully marked as obsolete #43144
Labels
breaking-change
Indicates a .NET Core breaking change
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
source incompatible
Source code may encounter a breaking change in behavior when targeting the new version.
⌚ Not Triaged
Not triaged
Description
Introduced with .NET 9 preview 6 - dotnet/runtime#103456.
Version
.NET 9 Preview 6
Previous behavior
The affected APIs had, and continue to have, no effect on types like
SslStream
orHttpClient
.This wasn't fully communicated to the user with existing obsoletions.
New behavior
Source code using any of the obsoleted static members will issue a warning.
Type of breaking change
Reason for change
In .NET 6, we've obsoleted WebRequest, WebClient, and ServicePoint (
SYSLIB0014
).See https://learn.microsoft.com/en-us/dotnet/core/compatibility/networking/6.0/webrequest-deprecated
To reduce the number of warnings, we didn't always obsolete the types themselves, instead obsoleting just the methods/constructors used to obtain their instances. For example, instead of marking
ServicePoint
as obsolete, we've obsoletedServicePointManager.FindServicePoint
instead.This failed to properly communicate to the user that they shouldn't be using
ServicePointManager
at all, as seen in issues like dotnet/dotnet-api-docs#6867 (ServicePointManager.ReusePort
).In .NET 9, we've expanded the use of the
SYSLIB0014
obsoletion diagnostic to apply to the wholeServicePointManager
type instead, and updated the documentation to note that settings onServicePointManager
no longer have any effect onSslStream
orHttpClient
.This is not a change in behavior in .NET 9, they had no effect in previous versions of .NET (Core) either.
Recommended action
Use
HttpClient
and related APIs like settings onSocketsHttpHandler
instead.We've written a new guide that offers more help around how to migrate to these types: https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-migrate-from-httpwebrequest
Feature area
Networking
Affected APIs
The
ServicePointManager
type.Note that some methods on the type were already marked as obsolete previously, and in .NET 9 we've expanded the obsoletion to the whole type instead. For example this means that properties like
ServicePointManager.ReusePort
would now show up as obsolete.The text was updated successfully, but these errors were encountered: