From 19cfb8a7c8dacd0d6bf57ee4f3b5abc43b251fb5 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Wed, 26 Aug 2020 17:25:16 +0200 Subject: [PATCH 1/8] Obsolete WebRequest, ServicePoint and WebClient --- src/libraries/Common/src/System/Obsoletions.cs | 3 +++ .../System.Net.Requests/src/System/Net/FileWebRequest.cs | 1 + .../System.Net.Requests/src/System/Net/HttpWebRequest.cs | 2 ++ .../System.Net.Requests/src/System/Net/WebRequest.cs | 7 +++++++ .../src/System/Net/ServicePointManager.cs | 3 +++ .../System.Net.WebClient/src/System/Net/WebClient.cs | 1 + 6 files changed, 17 insertions(+) diff --git a/src/libraries/Common/src/System/Obsoletions.cs b/src/libraries/Common/src/System/Obsoletions.cs index 0fc0731ad13444..331e8093602b05 100644 --- a/src/libraries/Common/src/System/Obsoletions.cs +++ b/src/libraries/Common/src/System/Obsoletions.cs @@ -42,5 +42,8 @@ internal static class Obsoletions internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead."; internal const string CodeBaseDiagId = "SYSLIB0012"; + + internal const string WebRequestMessage = "Use HttpClient api instead."; + internal const string WebRequestDiagId = "SYSLIB0013"; } } diff --git a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs index ce96ff6fcc8fa1..a29cd0186c81c9 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs @@ -36,6 +36,7 @@ internal FileWebRequest(Uri uri) } [Obsolete("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs index f305ea0901dc5d..604d4d3575847c 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs @@ -160,11 +160,13 @@ public bool AreParametersAcceptableForCaching() private const string ContinueHeader = "100-continue"; private const string ChunkedHeader = "chunked"; + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public HttpWebRequest() { } [Obsolete("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected HttpWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Net.Requests/src/System/Net/WebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/WebRequest.cs index 8f354beae3c599..bcdce17c44bf88 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/WebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/WebRequest.cs @@ -33,8 +33,10 @@ public WebRequestPrefixElement(string prefix, IWebRequestCreate creator) internal const int DefaultTimeoutMilliseconds = 100 * 1000; + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected WebRequest() { } + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected WebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) { throw new PlatformNotSupportedException(); @@ -140,6 +142,7 @@ private static WebRequest Create(Uri requestUri, bool useUriBase) // // Returns: // Newly created WebRequest. + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static WebRequest Create(string requestUriString) { if (requestUriString == null) @@ -160,6 +163,7 @@ public static WebRequest Create(string requestUriString) // // Returns: // Newly created WebRequest. + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static WebRequest Create(Uri requestUri) { if (requestUri == null) @@ -181,6 +185,7 @@ public static WebRequest Create(Uri requestUri) // // Returns: // Newly created WebRequest. + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static WebRequest CreateDefault(Uri requestUri) { if (requestUri == null) @@ -191,6 +196,7 @@ public static WebRequest CreateDefault(Uri requestUri) return Create(requestUri, true); } + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static HttpWebRequest CreateHttp(string requestUriString) { if (requestUriString == null) @@ -200,6 +206,7 @@ public static HttpWebRequest CreateHttp(string requestUriString) return CreateHttp(new Uri(requestUriString)); } + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static HttpWebRequest CreateHttp(Uri requestUri) { if (requestUri == null) diff --git a/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs b/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs index 228017952f3d04..267610d2d675f5 100644 --- a/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs +++ b/src/libraries/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs @@ -104,10 +104,13 @@ public static int DnsRefreshTimeout public static EncryptionPolicy EncryptionPolicy { get; } = EncryptionPolicy.RequireEncryption; + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static ServicePoint FindServicePoint(Uri address) => FindServicePoint(address, null); + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static ServicePoint FindServicePoint(string uriString, IWebProxy? proxy) => FindServicePoint(new Uri(uriString), proxy); + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public static ServicePoint FindServicePoint(Uri address, IWebProxy? proxy) { if (address == null) diff --git a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs index 129368a5d97251..1d3916bcfd0513 100644 --- a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs +++ b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs @@ -53,6 +53,7 @@ public class WebClient : Component private SendOrPostCallback? _reportDownloadProgressChanged; private SendOrPostCallback? _reportUploadProgressChanged; + [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public WebClient() { // We don't know if derived types need finalizing, but WebClient doesn't. From cb796a75cbfa4cbe6423328f21d250746f088821 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Thu, 27 Aug 2020 11:15:40 +0200 Subject: [PATCH 2/8] Update src/libraries/Common/src/System/Obsoletions.cs Co-authored-by: Cory Nelson --- src/libraries/Common/src/System/Obsoletions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/src/System/Obsoletions.cs b/src/libraries/Common/src/System/Obsoletions.cs index 331e8093602b05..50042eff9654db 100644 --- a/src/libraries/Common/src/System/Obsoletions.cs +++ b/src/libraries/Common/src/System/Obsoletions.cs @@ -43,7 +43,7 @@ internal static class Obsoletions internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead."; internal const string CodeBaseDiagId = "SYSLIB0012"; - internal const string WebRequestMessage = "Use HttpClient api instead."; + internal const string WebRequestMessage = "Use HttpClient instead."; internal const string WebRequestDiagId = "SYSLIB0013"; } } From 6b355f604e46700af2565f51b5effc6eec406655 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 09:40:13 +0200 Subject: [PATCH 3/8] Remove obsoletion from FileWebRequest --- .../System.Net.Requests/src/System/Net/FileWebRequest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs index a29cd0186c81c9..700996d85790e2 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs @@ -35,8 +35,6 @@ internal FileWebRequest(Uri uri) _uri = uri; } - [Obsolete("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] - [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { throw new PlatformNotSupportedException(); From 800a440dcd11da71e77a3359f5bc051ab70d67a8 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 12:30:08 +0200 Subject: [PATCH 4/8] Add refs assemblies obsoletion --- .../System.Net.Mail/src/System/Net/Mail/SmtpClient.cs | 2 ++ .../System.Net.Requests/ref/System.Net.Requests.cs | 11 ++++++++++- .../src/System/Net/FileWebRequest.cs | 2 ++ .../src/System/Net/FtpWebRequest.cs | 4 ++++ .../src/System/Net/HttpWebRequest.cs | 5 ++++- .../ref/System.Net.ServicePoint.cs | 3 +++ .../src/System.Net.ServicePoint.csproj | 2 ++ .../System.Net.WebClient/ref/System.Net.WebClient.cs | 1 + .../src/System.Net.WebClient.csproj | 2 ++ .../System.Net.WebClient/src/System/Net/WebClient.cs | 3 +++ 10 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs index 8bf41285740fb9..d7899fbbdc68d9 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs @@ -287,7 +287,9 @@ public ServicePoint ServicePoint // This has some subtle impact on behavior, e.g. the returned ServicePoint's Address property will // be usable, whereas in .NET Framework it throws an exception that "This property is not supported for // protocols that do not use URI." +#pragma warning disable SYSLIB0013 return _servicePoint ??= ServicePointManager.FindServicePoint(new Uri("mailto:" + _host + ":" + _port)); +#pragma warning restore SYSLIB0013 } } diff --git a/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs b/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs index 1fc5c6d2bdbb6d..8fe15d1c08dcd4 100644 --- a/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs +++ b/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs @@ -114,7 +114,9 @@ public enum FtpStatusCode } public sealed partial class FtpWebRequest : System.Net.WebRequest { +#pragma warning disable SYSLIB0013 internal FtpWebRequest() { } +#pragma warning restore SYSLIB0013 public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } set { } } public override string? ConnectionGroupName { get { throw null; } set { } } public override long ContentLength { get { throw null; } set { } } @@ -171,7 +173,7 @@ public GlobalProxySelection() { } public delegate void HttpContinueDelegate(int StatusCode, System.Net.WebHeaderCollection httpHeaders); public partial class HttpWebRequest : System.Net.WebRequest, System.Runtime.Serialization.ISerializable { - [System.ObsoleteAttribute("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected HttpWebRequest(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } public string? Accept { get { throw null; } set { } } public System.Uri Address { get { throw null; } } @@ -333,7 +335,9 @@ public enum WebExceptionStatus } public abstract partial class WebRequest : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable { + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected WebRequest() { } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected WebRequest(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } public System.Net.Security.AuthenticationLevel AuthenticationLevel { get { throw null; } set { } } public virtual System.Net.Cache.RequestCachePolicy? CachePolicy { get { throw null; } set { } } @@ -354,10 +358,15 @@ protected WebRequest(System.Runtime.Serialization.SerializationInfo serializatio public virtual void Abort() { } public virtual System.IAsyncResult BeginGetRequestStream(System.AsyncCallback? callback, object? state) { throw null; } public virtual System.IAsyncResult BeginGetResponse(System.AsyncCallback? callback, object? state) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest Create(string requestUriString) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest Create(System.Uri requestUri) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest CreateDefault(System.Uri requestUri) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.HttpWebRequest CreateHttp(string requestUriString) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.HttpWebRequest CreateHttp(System.Uri requestUri) { throw null; } public virtual System.IO.Stream EndGetRequestStream(System.IAsyncResult asyncResult) { throw null; } public virtual System.Net.WebResponse EndGetResponse(System.IAsyncResult asyncResult) { throw null; } diff --git a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs index 700996d85790e2..adde83770d6726 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs @@ -25,6 +25,7 @@ public class FileWebRequest : WebRequest, ISerializable private bool _syncHint; private int _aborted; +#pragma warning disable SYSLIB0013 internal FileWebRequest(Uri uri) { if (uri.Scheme != (object)Uri.UriSchemeFile) @@ -39,6 +40,7 @@ protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext s { throw new PlatformNotSupportedException(); } +#pragma warning restore SYSLIB0013 void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) => GetObjectData(serializationInfo, streamingContext); diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs index dacc4b7cf96219..a2cb0378724ae7 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs @@ -479,7 +479,9 @@ public override string? ConnectionGroupName } } +#pragma warning disable SYSLIB0013 public ServicePoint ServicePoint => _servicePoint ??= ServicePointManager.FindServicePoint(_uri); +#pragma warning restore SYSLIB0013 internal bool Aborted { @@ -489,7 +491,9 @@ internal bool Aborted } } +#pragma warning disable SYSLIB0013 internal FtpWebRequest(Uri uri) +#pragma warning restore SYSLIB0013 { if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, uri); diff --git a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs index 604d4d3575847c..60383dd22c261c 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs @@ -165,7 +165,6 @@ public HttpWebRequest() { } - [Obsolete("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] [Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] protected HttpWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { @@ -182,10 +181,12 @@ protected override void GetObjectData(SerializationInfo serializationInfo, Strea throw new PlatformNotSupportedException(); } +#pragma warning disable SYSLIB0013 internal HttpWebRequest(Uri uri) { _requestUri = uri; } +#pragma warning restore SYSLIB0013 private void SetSpecialHeaders(string HeaderName, string? value) { @@ -755,7 +756,9 @@ public HttpContinueDelegate? ContinueDelegate } } +#pragma warning disable SYSLIB0013 public ServicePoint ServicePoint => _servicePoint ??= ServicePointManager.FindServicePoint(Address, Proxy); +#pragma warning restore SYSLIB0013 public RemoteCertificateValidationCallback? ServerCertificateValidationCallback { get; set; } diff --git a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs index 3227108c37b542..5262c8b2509c3d 100644 --- a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs +++ b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs @@ -56,8 +56,11 @@ internal ServicePointManager() { } public static System.Net.SecurityProtocolType SecurityProtocol { get { throw null; } set { } } public static System.Net.Security.RemoteCertificateValidationCallback? ServerCertificateValidationCallback { get { throw null; } set { } } public static bool UseNagleAlgorithm { get { throw null; } set { } } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(string uriString, System.Net.IWebProxy? proxy) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(System.Uri address) { throw null; } + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(System.Uri address, System.Net.IWebProxy? proxy) { throw null; } public static void SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval) { } } diff --git a/src/libraries/System.Net.ServicePoint/src/System.Net.ServicePoint.csproj b/src/libraries/System.Net.ServicePoint/src/System.Net.ServicePoint.csproj index 24acad57cf4a90..54aae967357154 100644 --- a/src/libraries/System.Net.ServicePoint/src/System.Net.ServicePoint.csproj +++ b/src/libraries/System.Net.ServicePoint/src/System.Net.ServicePoint.csproj @@ -11,6 +11,8 @@ + diff --git a/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs b/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs index 4b035a4ecdd1d8..0c0113340872eb 100644 --- a/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs +++ b/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs @@ -72,6 +72,7 @@ public partial class UploadValuesCompletedEventArgs : System.ComponentModel.Asyn public delegate void UploadValuesCompletedEventHandler(object sender, System.Net.UploadValuesCompletedEventArgs e); public partial class WebClient : System.ComponentModel.Component { + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public WebClient() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] diff --git a/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj b/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj index 8f7d3b5c98891b..48a1a9c82537cc 100644 --- a/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj +++ b/src/libraries/System.Net.WebClient/src/System.Net.WebClient.csproj @@ -23,6 +23,8 @@ Link="Common\System\HexConverter.cs" /> + diff --git a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs index 1d3916bcfd0513..a6ad695378abbb 100644 --- a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs +++ b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs @@ -217,7 +217,10 @@ public IWebProxy? Proxy protected virtual WebRequest GetWebRequest(Uri address) { +#pragma warning disable SYSLIB0013 WebRequest request = WebRequest.Create(address); +#pragma warning restore SYSLIB0013 + CopyHeadersTo(request); if (Credentials != null) From 88a3699d0012b5db32c06f1ab029423ad508d5a0 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 12:35:01 +0200 Subject: [PATCH 5/8] Add missing attribute --- .../System.Net.Requests/src/System/Net/FileWebRequest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs index adde83770d6726..34ca8556abc691 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs @@ -36,6 +36,7 @@ internal FileWebRequest(Uri uri) _uri = uri; } + [Obsolete("Serialization is obsoleted for this type. https://go.microsoft.com/fwlink/?linkid=14202")] protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { throw new PlatformNotSupportedException(); From c973d5577e71bcb27f8fc68e059e911eafe298c3 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 14:51:39 +0200 Subject: [PATCH 6/8] Add missing attribute --- .../tests/System.Net.Requests.Tests.csproj | 4 +++- .../tests/System.Net.ServicePoint.Tests.csproj | 3 ++- .../tests/System.Net.WebClient.Tests.csproj | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index ecb8a780af90ce..8ef9f42d59dfed 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -4,7 +4,9 @@ true $(NetCoreAppCurrent) $(DefineConstants);NETSTANDARD - true + true + $(NoWarn);SYSLIB0013 diff --git a/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj b/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj index c82e88cf2d9074..fb50f2b9108960 100644 --- a/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj +++ b/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj @@ -2,9 +2,10 @@ true $(NetCoreAppCurrent) + $(NoWarn);SYSLIB0013 - \ No newline at end of file + diff --git a/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj b/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj index 140cbb8132dd0b..bae5e5ebf8c893 100644 --- a/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj +++ b/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent) $(DefineConstants);NETSTANDARD + $(NoWarn);SYSLIB0013 From 35e4b1fe0178bf63a1bb11397b2b4eef9941bbdc Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 15:48:23 +0200 Subject: [PATCH 7/8] Suppress warning for System.Media.SoundPlayer --- .../System.Windows.Extensions/src/System/Media/SoundPlayer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs b/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs index da68f709c4a250..0556fd45fee28c 100644 --- a/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs +++ b/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs @@ -259,7 +259,9 @@ private void LoadSync() // setup the http stream if (_uri != null && !_uri.IsFile && _stream == null) { +#pragma warning disable SYSLIB0013 WebRequest webRequest = WebRequest.Create(_uri); +#pragma warning restore SYSLIB0013 webRequest.Timeout = LoadTimeout; WebResponse webResponse; @@ -479,7 +481,9 @@ private async Task CopyStreamAsync(CancellationToken cancellationToken) // setup the http stream if (_uri != null && !_uri.IsFile && _stream == null) { +#pragma warning disable SYSLIB0013 WebRequest webRequest = WebRequest.Create(_uri); +#pragma warning restore SYSLIB0013 using (cancellationToken.Register(r => ((WebRequest)r).Abort(), webRequest)) { WebResponse webResponse = await webRequest.GetResponseAsync().ConfigureAwait(false); From a2acbc8cad0a493b595a0c7cf01fd1c00e60daaf Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 28 Aug 2020 16:50:11 +0200 Subject: [PATCH 8/8] Change message id --- .../Common/src/System/Obsoletions.cs | 2 +- .../src/System/Net/Mail/SmtpClient.cs | 4 ++-- .../ref/System.Net.Requests.cs | 20 +++++++++---------- .../src/System/Net/FileWebRequest.cs | 4 ++-- .../src/System/Net/FtpWebRequest.cs | 8 ++++---- .../src/System/Net/HttpWebRequest.cs | 8 ++++---- .../tests/System.Net.Requests.Tests.csproj | 5 ++--- .../ref/System.Net.ServicePoint.cs | 6 +++--- .../System.Net.ServicePoint.Tests.csproj | 2 +- .../ref/System.Net.WebClient.cs | 2 +- .../src/System/Net/WebClient.cs | 4 ++-- .../tests/System.Net.WebClient.Tests.csproj | 2 +- .../src/System/Media/SoundPlayer.cs | 8 ++++---- 13 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/libraries/Common/src/System/Obsoletions.cs b/src/libraries/Common/src/System/Obsoletions.cs index 50042eff9654db..45decebe154745 100644 --- a/src/libraries/Common/src/System/Obsoletions.cs +++ b/src/libraries/Common/src/System/Obsoletions.cs @@ -44,6 +44,6 @@ internal static class Obsoletions internal const string CodeBaseDiagId = "SYSLIB0012"; internal const string WebRequestMessage = "Use HttpClient instead."; - internal const string WebRequestDiagId = "SYSLIB0013"; + internal const string WebRequestDiagId = "SYSLIB0014"; } } diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs index d7899fbbdc68d9..9e87770828ebad 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs @@ -287,9 +287,9 @@ public ServicePoint ServicePoint // This has some subtle impact on behavior, e.g. the returned ServicePoint's Address property will // be usable, whereas in .NET Framework it throws an exception that "This property is not supported for // protocols that do not use URI." -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 return _servicePoint ??= ServicePointManager.FindServicePoint(new Uri("mailto:" + _host + ":" + _port)); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 } } diff --git a/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs b/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs index 8fe15d1c08dcd4..16570cd4a8154d 100644 --- a/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs +++ b/src/libraries/System.Net.Requests/ref/System.Net.Requests.cs @@ -114,9 +114,9 @@ public enum FtpStatusCode } public sealed partial class FtpWebRequest : System.Net.WebRequest { -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 internal FtpWebRequest() { } -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } set { } } public override string? ConnectionGroupName { get { throw null; } set { } } public override long ContentLength { get { throw null; } set { } } @@ -173,7 +173,7 @@ public GlobalProxySelection() { } public delegate void HttpContinueDelegate(int StatusCode, System.Net.WebHeaderCollection httpHeaders); public partial class HttpWebRequest : System.Net.WebRequest, System.Runtime.Serialization.ISerializable { - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected HttpWebRequest(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } public string? Accept { get { throw null; } set { } } public System.Uri Address { get { throw null; } } @@ -335,9 +335,9 @@ public enum WebExceptionStatus } public abstract partial class WebRequest : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable { - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected WebRequest() { } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] protected WebRequest(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } public System.Net.Security.AuthenticationLevel AuthenticationLevel { get { throw null; } set { } } public virtual System.Net.Cache.RequestCachePolicy? CachePolicy { get { throw null; } set { } } @@ -358,15 +358,15 @@ protected WebRequest(System.Runtime.Serialization.SerializationInfo serializatio public virtual void Abort() { } public virtual System.IAsyncResult BeginGetRequestStream(System.AsyncCallback? callback, object? state) { throw null; } public virtual System.IAsyncResult BeginGetResponse(System.AsyncCallback? callback, object? state) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest Create(string requestUriString) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest Create(System.Uri requestUri) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.WebRequest CreateDefault(System.Uri requestUri) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.HttpWebRequest CreateHttp(string requestUriString) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.HttpWebRequest CreateHttp(System.Uri requestUri) { throw null; } public virtual System.IO.Stream EndGetRequestStream(System.IAsyncResult asyncResult) { throw null; } public virtual System.Net.WebResponse EndGetResponse(System.IAsyncResult asyncResult) { throw null; } diff --git a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs index 34ca8556abc691..86cb50a5012cb0 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs @@ -25,7 +25,7 @@ public class FileWebRequest : WebRequest, ISerializable private bool _syncHint; private int _aborted; -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 internal FileWebRequest(Uri uri) { if (uri.Scheme != (object)Uri.UriSchemeFile) @@ -41,7 +41,7 @@ protected FileWebRequest(SerializationInfo serializationInfo, StreamingContext s { throw new PlatformNotSupportedException(); } -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) => GetObjectData(serializationInfo, streamingContext); diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs index a2cb0378724ae7..70de06c5a1c87e 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs @@ -479,9 +479,9 @@ public override string? ConnectionGroupName } } -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 public ServicePoint ServicePoint => _servicePoint ??= ServicePointManager.FindServicePoint(_uri); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 internal bool Aborted { @@ -491,9 +491,9 @@ internal bool Aborted } } -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 internal FtpWebRequest(Uri uri) -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 { if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, uri); diff --git a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs index 60383dd22c261c..327e60cbcdb143 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/HttpWebRequest.cs @@ -181,12 +181,12 @@ protected override void GetObjectData(SerializationInfo serializationInfo, Strea throw new PlatformNotSupportedException(); } -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 internal HttpWebRequest(Uri uri) { _requestUri = uri; } -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 private void SetSpecialHeaders(string HeaderName, string? value) { @@ -756,9 +756,9 @@ public HttpContinueDelegate? ContinueDelegate } } -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 public ServicePoint ServicePoint => _servicePoint ??= ServicePointManager.FindServicePoint(Address, Proxy); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 public RemoteCertificateValidationCallback? ServerCertificateValidationCallback { get; set; } diff --git a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index 8ef9f42d59dfed..be502f34b17d8e 100644 --- a/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/src/libraries/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -4,9 +4,8 @@ true $(NetCoreAppCurrent) $(DefineConstants);NETSTANDARD - true - $(NoWarn);SYSLIB0013 + true + $(NoWarn);SYSLIB0014 diff --git a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs index 5262c8b2509c3d..d7adfc5a1484e9 100644 --- a/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs +++ b/src/libraries/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs @@ -56,11 +56,11 @@ internal ServicePointManager() { } public static System.Net.SecurityProtocolType SecurityProtocol { get { throw null; } set { } } public static System.Net.Security.RemoteCertificateValidationCallback? ServerCertificateValidationCallback { get { throw null; } set { } } public static bool UseNagleAlgorithm { get { throw null; } set { } } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(string uriString, System.Net.IWebProxy? proxy) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(System.Uri address) { throw null; } - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public static System.Net.ServicePoint FindServicePoint(System.Uri address, System.Net.IWebProxy? proxy) { throw null; } public static void SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval) { } } diff --git a/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj b/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj index fb50f2b9108960..cad52ea6fd2afc 100644 --- a/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj +++ b/src/libraries/System.Net.ServicePoint/tests/System.Net.ServicePoint.Tests.csproj @@ -2,7 +2,7 @@ true $(NetCoreAppCurrent) - $(NoWarn);SYSLIB0013 + $(NoWarn);SYSLIB0014 diff --git a/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs b/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs index 0c0113340872eb..151ee487f4866b 100644 --- a/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs +++ b/src/libraries/System.Net.WebClient/ref/System.Net.WebClient.cs @@ -72,7 +72,7 @@ public partial class UploadValuesCompletedEventArgs : System.ComponentModel.Asyn public delegate void UploadValuesCompletedEventHandler(object sender, System.Net.UploadValuesCompletedEventArgs e); public partial class WebClient : System.ComponentModel.Component { - [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Use HttpClient instead.", DiagnosticId = "SYSLIB0014", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public WebClient() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] diff --git a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs index a6ad695378abbb..37e0a0f704dfa3 100644 --- a/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs +++ b/src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs @@ -217,9 +217,9 @@ public IWebProxy? Proxy protected virtual WebRequest GetWebRequest(Uri address) { -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 WebRequest request = WebRequest.Create(address); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 CopyHeadersTo(request); diff --git a/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj b/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj index bae5e5ebf8c893..bd9c2cc5549542 100644 --- a/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj +++ b/src/libraries/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj @@ -2,7 +2,7 @@ $(NetCoreAppCurrent) $(DefineConstants);NETSTANDARD - $(NoWarn);SYSLIB0013 + $(NoWarn);SYSLIB0014 diff --git a/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs b/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs index 0556fd45fee28c..74c397b26d10eb 100644 --- a/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs +++ b/src/libraries/System.Windows.Extensions/src/System/Media/SoundPlayer.cs @@ -259,9 +259,9 @@ private void LoadSync() // setup the http stream if (_uri != null && !_uri.IsFile && _stream == null) { -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 WebRequest webRequest = WebRequest.Create(_uri); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 webRequest.Timeout = LoadTimeout; WebResponse webResponse; @@ -481,9 +481,9 @@ private async Task CopyStreamAsync(CancellationToken cancellationToken) // setup the http stream if (_uri != null && !_uri.IsFile && _stream == null) { -#pragma warning disable SYSLIB0013 +#pragma warning disable SYSLIB0014 WebRequest webRequest = WebRequest.Create(_uri); -#pragma warning restore SYSLIB0013 +#pragma warning restore SYSLIB0014 using (cancellationToken.Register(r => ((WebRequest)r).Abort(), webRequest)) { WebResponse webResponse = await webRequest.GetResponseAsync().ConfigureAwait(false);