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">
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview1-17051</InternalAspNetCoreSdkPackageVersion>
<InternalAspNetCoreAnalyzersPackageVersion>1.0.0</InternalAspNetCoreAnalyzersPackageVersion>
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-preview1-34184</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>

View File

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

View File

@ -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)

View File

@ -29,7 +29,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
private int _stopping;
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)
#pragma warning restore PUB0001
: 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.
/// </summary>
/// <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;
#pragma warning restore PUB0001 // Pubternal type in public API
/// <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>
/// <remarks>
/// Defaults to true.

View File

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

View File

@ -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)
{