From 27799b5acb59523889a3a52a39d606e795b81c50 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Wed, 16 May 2018 13:42:56 -0700 Subject: [PATCH] Enable pubternability analyzer (#2560) --- build/dependencies.props | 1 + src/Directory.Build.props | 13 +++++++------ src/Kestrel.Core/BadHttpRequestException.cs | 2 ++ src/Kestrel.Core/KestrelServer.cs | 2 ++ src/Kestrel.Core/KestrelServerOptions.cs | 4 +++- src/Kestrel.Core/ListenOptions.cs | 6 ++++++ .../SocketTransportFactory.cs | 4 ++++ 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index e77be8ddb4..7519796364 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -6,6 +6,7 @@ 0.10.13 2.2.0-preview1-17051 + 1.0.0 1.10.0 2.2.0-preview1-34184 2.2.0-preview1-34184 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7a6afb7743..baaff5ff9b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,7 @@ - - - - - - + + + + + + + diff --git a/src/Kestrel.Core/BadHttpRequestException.cs b/src/Kestrel.Core/BadHttpRequestException.cs index 033c8d9e1b..db3e9f0dd4 100644 --- a/src/Kestrel.Core/BadHttpRequestException.cs +++ b/src/Kestrel.Core/BadHttpRequestException.cs @@ -42,8 +42,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core } [StackTraceHidden] +#pragma warning disable PUB0001 // Pubternal type in public API public static void Throw(RequestRejectionReason reason, HttpMethod method) => throw GetException(reason, method.ToString().ToUpperInvariant()); +#pragma warning restore PUB0001 // Pubternal type in public API [MethodImpl(MethodImplOptions.NoInlining)] internal static BadHttpRequestException GetException(RequestRejectionReason reason) diff --git a/src/Kestrel.Core/KestrelServer.cs b/src/Kestrel.Core/KestrelServer.cs index d83d29ef84..a65e858eb1 100644 --- a/src/Kestrel.Core/KestrelServer.cs +++ b/src/Kestrel.Core/KestrelServer.cs @@ -29,7 +29,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core private int _stopping; private readonly TaskCompletionSource _stoppedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); +#pragma warning disable PUB0001 // Pubternal type in public API public KestrelServer(IOptions options, ITransportFactory transportFactory, ILoggerFactory loggerFactory) +#pragma warning restore PUB0001 : this(transportFactory, CreateServiceContext(options, loggerFactory)) { } diff --git a/src/Kestrel.Core/KestrelServerOptions.cs b/src/Kestrel.Core/KestrelServerOptions.cs index 6c62edc336..187728a716 100644 --- a/src/Kestrel.Core/KestrelServerOptions.cs +++ b/src/Kestrel.Core/KestrelServerOptions.cs @@ -42,10 +42,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core /// Gets or sets a value that determines how Kestrel should schedule user callbacks. /// /// The default mode is +#pragma warning disable PUB0001 // Pubternal type in public API public SchedulingMode ApplicationSchedulingMode { get; set; } = SchedulingMode.Default; +#pragma warning restore PUB0001 // Pubternal type in public API /// - /// Gets or sets a value that controls whether synchronous IO is allowed for the and + /// Gets or sets a value that controls whether synchronous IO is allowed for the and /// /// /// Defaults to true. diff --git a/src/Kestrel.Core/ListenOptions.cs b/src/Kestrel.Core/ListenOptions.cs index 5ae8b31468..056e343fb5 100644 --- a/src/Kestrel.Core/ListenOptions.cs +++ b/src/Kestrel.Core/ListenOptions.cs @@ -58,9 +58,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core /// /// The type of interface being described: either an , Unix domain socket path, or a file descriptor. /// +#pragma warning disable PUB0001 // Pubternal type in public API public ListenType Type { get; } +#pragma warning restore PUB0001 // Pubternal type in public API +#pragma warning disable PUB0001 // Pubternal type in public API public FileHandleType HandleType +#pragma warning restore PUB0001 // Pubternal type in public API { get => _handleType; set @@ -134,7 +138,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core /// /// Defaults to empty. /// +#pragma warning disable PUB0001 // Pubternal type in public API public List ConnectionAdapters { get; } = new List(); +#pragma warning restore PUB0001 // Pubternal type in public API public IServiceProvider ApplicationServices => KestrelServerOptions?.ApplicationServices; diff --git a/src/Kestrel.Transport.Sockets/SocketTransportFactory.cs b/src/Kestrel.Transport.Sockets/SocketTransportFactory.cs index 2e0e8170ef..11046878da 100644 --- a/src/Kestrel.Transport.Sockets/SocketTransportFactory.cs +++ b/src/Kestrel.Transport.Sockets/SocketTransportFactory.cs @@ -10,7 +10,9 @@ using Microsoft.AspNetCore.Hosting; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets { +#pragma warning disable PUB0001 // Pubternal type in public API public sealed class SocketTransportFactory : ITransportFactory +#pragma warning restore PUB0001 // Pubternal type in public API { private readonly SocketTransportOptions _options; private readonly IApplicationLifetime _appLifetime; @@ -40,7 +42,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets _trace = new SocketsTrace(logger); } +#pragma warning disable PUB0001 // Pubternal type in public API public ITransport Create(IEndPointInformation endPointInformation, IConnectionDispatcher dispatcher) +#pragma warning restore PUB0001 // Pubternal type in public API { if (endPointInformation == null) {