From 0b59065c3b9b2ef6be6c5e49e41f705f5031fda1 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Wed, 13 Jan 2021 12:29:06 -0800 Subject: [PATCH 1/3] Update Server's Obsolete messages and comments --- src/Servers/IIS/IIS/src/BadHttpRequestException.cs | 2 +- .../IIS/src/Core/IISServerAuthenticationHandler.cs | 2 +- .../src/Core/ThrowingWasUpgradedWriteOnlyStream.cs | 2 +- src/Servers/IIS/IIS/src/Core/WrappingStream.cs | 1 - src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs | 2 +- src/Servers/IIS/IIS/src/HttpContextExtensions.cs | 3 ++- .../Kestrel/Core/src/BadHttpRequestException.cs | 2 +- .../src/Internal/Infrastructure/WrappingStream.cs | 1 - .../Transport.Libuv/src/LibuvTransportOptions.cs | 12 ++++++------ .../src/WebHostBuilderLibuvExtensions.cs | 6 +++--- 10 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Servers/IIS/IIS/src/BadHttpRequestException.cs b/src/Servers/IIS/IIS/src/BadHttpRequestException.cs index 68b227a8cba6..67e18921ee11 100644 --- a/src/Servers/IIS/IIS/src/BadHttpRequestException.cs +++ b/src/Servers/IIS/IIS/src/BadHttpRequestException.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.IIS { /// - [Obsolete("Moved to Microsoft.AspNetCore.Http.BadHttpRequestException")] + [Obsolete("Moved to Microsoft.AspNetCore.Http.BadHttpRequestException. See https://aka.ms/badhttprequestexception for details.")] // Never remove. public sealed class BadHttpRequestException : Microsoft.AspNetCore.Http.BadHttpRequestException { internal BadHttpRequestException(string message, int statusCode, RequestRejectionReason reason) diff --git a/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs b/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs index cb4d484fd679..5e83dd2b4a33 100644 --- a/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs +++ b/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// The default authentication handler with IIS In-Process /// - [Obsolete("The IISServerAuthenticationHandler is obsolete and will be removed in a future release.")] + [Obsolete("The IISServerAuthenticationHandler is obsolete and will be removed in a future release.")] // Never remove. public class IISServerAuthenticationHandler : IAuthenticationHandler { private HttpContext? _context; diff --git a/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs b/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs index 9fdff5b6fe01..23231d5b6707 100644 --- a/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs +++ b/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// Users should not need to instantiate this class. /// - [Obsolete("The ThrowingWasUpgradedWriteOnlyStream is obsolete and will be removed in a future release.")] + [Obsolete("The ThrowingWasUpgradedWriteOnlyStream is obsolete and will be removed in a future release.")] // Never remove. public class ThrowingWasUpgradedWriteOnlyStream : WriteOnlyStream { /// diff --git a/src/Servers/IIS/IIS/src/Core/WrappingStream.cs b/src/Servers/IIS/IIS/src/Core/WrappingStream.cs index 8ecc698d2733..6e2268247b09 100644 --- a/src/Servers/IIS/IIS/src/Core/WrappingStream.cs +++ b/src/Servers/IIS/IIS/src/Core/WrappingStream.cs @@ -107,7 +107,6 @@ public override int EndRead(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult) => _inner.EndWrite(asyncResult); - [Obsolete("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public override object InitializeLifetimeService() => _inner.InitializeLifetimeService(); diff --git a/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs b/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs index 0a699ff7b0ab..c3f44a739e6d 100644 --- a/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs +++ b/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// A which only allows for writes. /// - [Obsolete("The WriteOnlyStream is obsolete and will be removed in a future release.")] + [Obsolete("The WriteOnlyStream is obsolete and will be removed in a future release.")] // Never remove. public abstract class WriteOnlyStream : Stream { /// diff --git a/src/Servers/IIS/IIS/src/HttpContextExtensions.cs b/src/Servers/IIS/IIS/src/HttpContextExtensions.cs index 05602353c3ae..d19fb1abbcbd 100644 --- a/src/Servers/IIS/IIS/src/HttpContextExtensions.cs +++ b/src/Servers/IIS/IIS/src/HttpContextExtensions.cs @@ -21,7 +21,8 @@ public static class HttpContextExtensions /// null if the server does not support the feature. /// May return null or empty if the variable does not exist or is not set. /// - [Obsolete("This is obsolete and will be removed in a future version. Use " + nameof(HttpContextServerVariableExtensions.GetServerVariable) + " instead.")] + [Obsolete("This is obsolete and will be removed in a future version. Use " + + nameof(HttpContextServerVariableExtensions.GetServerVariable) + " instead.")] // Never remove. public static string? GetIISServerVariable(this HttpContext context, string variableName) => context.GetServerVariable(variableName); } diff --git a/src/Servers/Kestrel/Core/src/BadHttpRequestException.cs b/src/Servers/Kestrel/Core/src/BadHttpRequestException.cs index 983b2f123430..580288b1e62a 100644 --- a/src/Servers/Kestrel/Core/src/BadHttpRequestException.cs +++ b/src/Servers/Kestrel/Core/src/BadHttpRequestException.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core /// /// An exception thrown when a malformed http request has been received. /// - [Obsolete("Moved to Microsoft.AspNetCore.Http.BadHttpRequestException")] + [Obsolete("Moved to Microsoft.AspNetCore.Http.BadHttpRequestException. See https://aka.ms/badhttprequestexception for details.")] // Never remove. public sealed class BadHttpRequestException : Microsoft.AspNetCore.Http.BadHttpRequestException { internal BadHttpRequestException(string message, int statusCode, RequestRejectionReason reason) diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs index a49299c4da34..02c79c58c449 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs @@ -107,7 +107,6 @@ public override int EndRead(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult) => _inner.EndWrite(asyncResult); - [Obsolete("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public override object InitializeLifetimeService() => _inner.InitializeLifetimeService(); diff --git a/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs b/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs index ee96297f1d07..6545f134e822 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv /// /// Provides programmatic configuration of Libuv transport features. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public class LibuvTransportOptions { /// @@ -18,7 +18,7 @@ public class LibuvTransportOptions /// /// Defaults to half of rounded down and clamped between 1 and 16. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public int ThreadCount { get; set; } = ProcessorThreadCount; /// @@ -27,7 +27,7 @@ public class LibuvTransportOptions /// /// Defaults to true. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public bool NoDelay { get; set; } = true; /// @@ -36,13 +36,13 @@ public class LibuvTransportOptions /// /// Defaults to 128. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public int Backlog { get; set; } = 128; - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public long? MaxReadBufferSize { get; set; } = 1024 * 1024; - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public long? MaxWriteBufferSize { get; set; } = 64 * 1024; internal Func> MemoryPoolFactory { get; set; } = System.Buffers.SlabMemoryPoolFactory.Create; diff --git a/src/Servers/Kestrel/Transport.Libuv/src/WebHostBuilderLibuvExtensions.cs b/src/Servers/Kestrel/Transport.Libuv/src/WebHostBuilderLibuvExtensions.cs index 3bd895455702..95459ea27d97 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/WebHostBuilderLibuvExtensions.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/WebHostBuilderLibuvExtensions.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Hosting /// /// Libuv extensions. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public static class WebHostBuilderLibuvExtensions { /// @@ -24,7 +24,7 @@ public static class WebHostBuilderLibuvExtensions /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder) { return hostBuilder.ConfigureServices(services => @@ -45,7 +45,7 @@ public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder) /// /// The Microsoft.AspNetCore.Hosting.IWebHostBuilder. /// - [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] + [Obsolete("The libuv transport is obsolete and will be removed in a future release. See https://aka.ms/libuvtransport for details.", error: false)] // Remove after .NET 6. public static IWebHostBuilder UseLibuv(this IWebHostBuilder hostBuilder, Action configureOptions) { return hostBuilder.UseLibuv().ConfigureServices(services => From 46c2d50d14679fafa1caa648a94ff62d74e45bd2 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Wed, 13 Jan 2021 13:40:43 -0800 Subject: [PATCH 2/3] Fix compile errors --- src/Servers/IIS/IIS/src/Core/WrappingStream.cs | 2 ++ .../Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Servers/IIS/IIS/src/Core/WrappingStream.cs b/src/Servers/IIS/IIS/src/Core/WrappingStream.cs index 6e2268247b09..6bbd71c2fd4e 100644 --- a/src/Servers/IIS/IIS/src/Core/WrappingStream.cs +++ b/src/Servers/IIS/IIS/src/Core/WrappingStream.cs @@ -107,8 +107,10 @@ public override int EndRead(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult) => _inner.EndWrite(asyncResult); +#pragma warning disable CS0672, SYSLIB0010 // Overrides obsolete member public override object InitializeLifetimeService() => _inner.InitializeLifetimeService(); +#pragma warning restore CS0672, SYSLIB0010 // Overrides obsolete member public override void Close() => _inner.Close(); diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs index 02c79c58c449..b6ce1ca9c3a2 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs @@ -107,8 +107,10 @@ public override int EndRead(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult) => _inner.EndWrite(asyncResult); +#pragma warning disable CS0672, SYSLIB0010 // Overrides obsolete member public override object InitializeLifetimeService() => _inner.InitializeLifetimeService(); +#pragma warning restore CS0672, SYSLIB0010 // Overrides obsolete member public override void Close() => _inner.Close(); From a81938dcf0e7053eb0025917c6c40e8e020a3c7e Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Thu, 14 Jan 2021 11:15:24 -0800 Subject: [PATCH 3/3] Address PR feedback --- src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs | 2 +- .../IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs | 2 +- src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs b/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs index 5e83dd2b4a33..a31ccbe87927 100644 --- a/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs +++ b/src/Servers/IIS/IIS/src/Core/IISServerAuthenticationHandler.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// The default authentication handler with IIS In-Process /// - [Obsolete("The IISServerAuthenticationHandler is obsolete and will be removed in a future release.")] // Never remove. + [Obsolete("The IISServerAuthenticationHandler is obsolete and will be removed in a future release.")] // Remove after .NET 6. public class IISServerAuthenticationHandler : IAuthenticationHandler { private HttpContext? _context; diff --git a/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs b/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs index 23231d5b6707..6ec6333464f8 100644 --- a/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs +++ b/src/Servers/IIS/IIS/src/Core/ThrowingWasUpgradedWriteOnlyStream.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// Users should not need to instantiate this class. /// - [Obsolete("The ThrowingWasUpgradedWriteOnlyStream is obsolete and will be removed in a future release.")] // Never remove. + [Obsolete("The ThrowingWasUpgradedWriteOnlyStream is obsolete and will be removed in a future release.")] // Remove after .NET 6. public class ThrowingWasUpgradedWriteOnlyStream : WriteOnlyStream { /// diff --git a/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs b/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs index c3f44a739e6d..0fc9c05a782f 100644 --- a/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs +++ b/src/Servers/IIS/IIS/src/Core/WriteOnlyStream.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// A which only allows for writes. /// - [Obsolete("The WriteOnlyStream is obsolete and will be removed in a future release.")] // Never remove. + [Obsolete("The WriteOnlyStream is obsolete and will be removed in a future release.")] // Remove after .NET 6. public abstract class WriteOnlyStream : Stream { ///