Enable pubternability analyzer (#2560)

This commit is contained in:
Pavel Krymets 2018-05-16 13:42:56 -07:00 committed by GitHub
parent aaaff4475a
commit 27799b5acb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 7 deletions

View File

@ -6,6 +6,7 @@
<PropertyGroup Label="Package Versions"> <PropertyGroup Label="Package Versions">
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion> <BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview1-17051</InternalAspNetCoreSdkPackageVersion> <InternalAspNetCoreSdkPackageVersion>2.2.0-preview1-17051</InternalAspNetCoreSdkPackageVersion>
<InternalAspNetCoreAnalyzersPackageVersion>1.0.0</InternalAspNetCoreAnalyzersPackageVersion>
<LibuvPackageVersion>1.10.0</LibuvPackageVersion> <LibuvPackageVersion>1.10.0</LibuvPackageVersion>
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreAllPackageVersion> <MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion> <MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>

View File

@ -1,6 +1,7 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
<ItemGroup> <ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" /> <PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
</ItemGroup> <PackageReference Include="Internal.AspNetCore.Analyzers" PrivateAssets="All" Version="$(InternalAspNetCoreAnalyzersPackageVersion)" />
</Project> </ItemGroup>
</Project>

View File

@ -42,8 +42,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
} }
[StackTraceHidden] [StackTraceHidden]
#pragma warning disable PUB0001 // Pubternal type in public API
public static void Throw(RequestRejectionReason reason, HttpMethod method) public static void Throw(RequestRejectionReason reason, HttpMethod method)
=> throw GetException(reason, method.ToString().ToUpperInvariant()); => throw GetException(reason, method.ToString().ToUpperInvariant());
#pragma warning restore PUB0001 // Pubternal type in public API
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
internal static BadHttpRequestException GetException(RequestRejectionReason reason) internal static BadHttpRequestException GetException(RequestRejectionReason reason)

View File

@ -29,7 +29,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
private int _stopping; private int _stopping;
private readonly TaskCompletionSource<object> _stoppedTcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously); private readonly TaskCompletionSource<object> _stoppedTcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
#pragma warning disable PUB0001 // Pubternal type in public API
public KestrelServer(IOptions<KestrelServerOptions> options, ITransportFactory transportFactory, ILoggerFactory loggerFactory) public KestrelServer(IOptions<KestrelServerOptions> options, ITransportFactory transportFactory, ILoggerFactory loggerFactory)
#pragma warning restore PUB0001
: this(transportFactory, CreateServiceContext(options, loggerFactory)) : this(transportFactory, CreateServiceContext(options, loggerFactory))
{ {
} }

View File

@ -42,10 +42,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
/// Gets or sets a value that determines how Kestrel should schedule user callbacks. /// Gets or sets a value that determines how Kestrel should schedule user callbacks.
/// </summary> /// </summary>
/// <remarks>The default mode is <see cref="SchedulingMode.Default"/></remarks> /// <remarks>The default mode is <see cref="SchedulingMode.Default"/></remarks>
#pragma warning disable PUB0001 // Pubternal type in public API
public SchedulingMode ApplicationSchedulingMode { get; set; } = SchedulingMode.Default; public SchedulingMode ApplicationSchedulingMode { get; set; } = SchedulingMode.Default;
#pragma warning restore PUB0001 // Pubternal type in public API
/// <summary> /// <summary>
/// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/> /// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Defaults to true. /// Defaults to true.

View File

@ -58,9 +58,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
/// <summary> /// <summary>
/// The type of interface being described: either an <see cref="IPEndPoint"/>, Unix domain socket path, or a file descriptor. /// The type of interface being described: either an <see cref="IPEndPoint"/>, Unix domain socket path, or a file descriptor.
/// </summary> /// </summary>
#pragma warning disable PUB0001 // Pubternal type in public API
public ListenType Type { get; } 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 public FileHandleType HandleType
#pragma warning restore PUB0001 // Pubternal type in public API
{ {
get => _handleType; get => _handleType;
set set
@ -134,7 +138,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
/// <remarks> /// <remarks>
/// Defaults to empty. /// Defaults to empty.
/// </remarks> /// </remarks>
#pragma warning disable PUB0001 // Pubternal type in public API
public List<IConnectionAdapter> ConnectionAdapters { get; } = new List<IConnectionAdapter>(); public List<IConnectionAdapter> ConnectionAdapters { get; } = new List<IConnectionAdapter>();
#pragma warning restore PUB0001 // Pubternal type in public API
public IServiceProvider ApplicationServices => KestrelServerOptions?.ApplicationServices; public IServiceProvider ApplicationServices => KestrelServerOptions?.ApplicationServices;

View File

@ -10,7 +10,9 @@ using Microsoft.AspNetCore.Hosting;
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
{ {
#pragma warning disable PUB0001 // Pubternal type in public API
public sealed class SocketTransportFactory : ITransportFactory public sealed class SocketTransportFactory : ITransportFactory
#pragma warning restore PUB0001 // Pubternal type in public API
{ {
private readonly SocketTransportOptions _options; private readonly SocketTransportOptions _options;
private readonly IApplicationLifetime _appLifetime; private readonly IApplicationLifetime _appLifetime;
@ -40,7 +42,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
_trace = new SocketsTrace(logger); _trace = new SocketsTrace(logger);
} }
#pragma warning disable PUB0001 // Pubternal type in public API
public ITransport Create(IEndPointInformation endPointInformation, IConnectionDispatcher dispatcher) public ITransport Create(IEndPointInformation endPointInformation, IConnectionDispatcher dispatcher)
#pragma warning restore PUB0001 // Pubternal type in public API
{ {
if (endPointInformation == null) if (endPointInformation == null)
{ {