diff --git a/benchmarkapps/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs b/benchmarkapps/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs index c6d2cdbdf9..ea9e2a55f3 100644 --- a/benchmarkapps/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs +++ b/benchmarkapps/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs @@ -3,7 +3,6 @@ using System; using System.Net; -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Configuration; diff --git a/benchmarkapps/PlatformBenchmarks/BufferExtensions.cs b/benchmarkapps/PlatformBenchmarks/BufferExtensions.cs index d39beff830..9551661831 100644 --- a/benchmarkapps/PlatformBenchmarks/BufferExtensions.cs +++ b/benchmarkapps/PlatformBenchmarks/BufferExtensions.cs @@ -4,7 +4,6 @@ using System; using System.Buffers; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; namespace PlatformBenchmarks { diff --git a/benchmarkapps/PlatformBenchmarks/DateHeader.cs b/benchmarkapps/PlatformBenchmarks/DateHeader.cs index 18897dfcb3..bbc7d7daaa 100644 --- a/benchmarkapps/PlatformBenchmarks/DateHeader.cs +++ b/benchmarkapps/PlatformBenchmarks/DateHeader.cs @@ -6,14 +6,13 @@ using System.Buffers.Text; using System.Diagnostics; using System.Text; using System.Threading; -using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { /// /// Manages the generation of the date header value. /// - internal static class DateHeader + internal static class DateHeader { const int prefixLength = 8; // "\r\nDate: ".Length const int dateTimeRLength = 29; // Wed, 14 Mar 2018 14:20:00 GMT diff --git a/benchmarkapps/PlatformBenchmarks/Startup.cs b/benchmarkapps/PlatformBenchmarks/Startup.cs index a2bcbe88fc..fc04173046 100644 --- a/benchmarkapps/PlatformBenchmarks/Startup.cs +++ b/benchmarkapps/PlatformBenchmarks/Startup.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using Microsoft.AspNetCore.Builder; namespace PlatformBenchmarks @@ -10,7 +9,7 @@ namespace PlatformBenchmarks { public void Configure(IApplicationBuilder app) { - + } } } diff --git a/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs b/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs index 2e4d6a6742..3f8bae879f 100644 --- a/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs +++ b/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Buffers; using System.IO.Pipelines; using System.Runtime.CompilerServices; using System.Threading; diff --git a/benchmarks/Kestrel.Performance/InMemoryTransportBenchmark.cs b/benchmarks/Kestrel.Performance/InMemoryTransportBenchmark.cs index 0e77ddd9c5..1816531088 100644 --- a/benchmarks/Kestrel.Performance/InMemoryTransportBenchmark.cs +++ b/benchmarks/Kestrel.Performance/InMemoryTransportBenchmark.cs @@ -3,7 +3,6 @@ using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; diff --git a/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs b/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs index eb0cedad24..b37656faec 100644 --- a/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs +++ b/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Buffers; using System.IO.Pipelines; using System.Threading.Tasks; diff --git a/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs b/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs index 6b06f6aac9..eb45d5cd3f 100644 --- a/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs +++ b/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Buffers; using System.IO.Pipelines; using System.Runtime.CompilerServices; using System.Text; diff --git a/samples/LargeResponseApp/Startup.cs b/samples/LargeResponseApp/Startup.cs index c2b7d30a1b..8135247cf9 100644 --- a/samples/LargeResponseApp/Startup.cs +++ b/samples/LargeResponseApp/Startup.cs @@ -20,9 +20,8 @@ namespace LargeResponseApp { app.Run(async (context) => { - int numChunks; var path = context.Request.Path; - if (!path.HasValue || !int.TryParse(path.Value.Substring(1), out numChunks)) + if (!path.HasValue || !int.TryParse(path.Value.Substring(1), out var numChunks)) { numChunks = _defaultNumChunks; } diff --git a/samples/SampleApp/Startup.cs b/samples/SampleApp/Startup.cs index bb070eb348..166b47a932 100644 --- a/samples/SampleApp/Startup.cs +++ b/samples/SampleApp/Startup.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Https.Internal; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; using Microsoft.Extensions.Configuration; diff --git a/src/Connections.Abstractions/ConnectionBuilder.cs b/src/Connections.Abstractions/ConnectionBuilder.cs index b75e92b60f..9000d99a73 100644 --- a/src/Connections.Abstractions/ConnectionBuilder.cs +++ b/src/Connections.Abstractions/ConnectionBuilder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; namespace Microsoft.AspNetCore.Connections diff --git a/src/Connections.Abstractions/ConnectionItems.cs b/src/Connections.Abstractions/ConnectionItems.cs index 0f01a62111..f5c7dd0352 100644 --- a/src/Connections.Abstractions/ConnectionItems.cs +++ b/src/Connections.Abstractions/ConnectionItems.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections; -using System.Collections.Concurrent; using System.Collections.Generic; namespace Microsoft.AspNetCore.Connections @@ -98,8 +96,7 @@ namespace Microsoft.AspNetCore.Connections bool ICollection>.Remove(KeyValuePair item) { - object value; - if (Items.TryGetValue(item.Key, out value) && Equals(item.Value, value)) + if (Items.TryGetValue(item.Key, out var value) && Equals(item.Value, value)) { return Items.Remove(item.Key); } diff --git a/src/Connections.Abstractions/Features/IConnectionInherentKeepAliveFeature.cs b/src/Connections.Abstractions/Features/IConnectionInherentKeepAliveFeature.cs index d5751f8bcf..dca2674357 100644 --- a/src/Connections.Abstractions/Features/IConnectionInherentKeepAliveFeature.cs +++ b/src/Connections.Abstractions/Features/IConnectionInherentKeepAliveFeature.cs @@ -1,10 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Text; - namespace Microsoft.AspNetCore.Connections.Features { /// diff --git a/src/Connections.Abstractions/Features/IConnectionItemsFeature.cs b/src/Connections.Abstractions/Features/IConnectionItemsFeature.cs index a3aef44310..3d40d5498f 100644 --- a/src/Connections.Abstractions/Features/IConnectionItemsFeature.cs +++ b/src/Connections.Abstractions/Features/IConnectionItemsFeature.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; namespace Microsoft.AspNetCore.Connections.Features diff --git a/src/Connections.Abstractions/Features/IConnectionTransportFeature.cs b/src/Connections.Abstractions/Features/IConnectionTransportFeature.cs index 7468dbc722..0b218972d7 100644 --- a/src/Connections.Abstractions/Features/IConnectionTransportFeature.cs +++ b/src/Connections.Abstractions/Features/IConnectionTransportFeature.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Buffers; using System.IO.Pipelines; -using System.Threading; namespace Microsoft.AspNetCore.Connections.Features { diff --git a/src/Connections.Abstractions/Features/IMemoryPoolFeature.cs b/src/Connections.Abstractions/Features/IMemoryPoolFeature.cs index 0a7e28533e..24b56763b0 100644 --- a/src/Connections.Abstractions/Features/IMemoryPoolFeature.cs +++ b/src/Connections.Abstractions/Features/IMemoryPoolFeature.cs @@ -2,8 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Buffers; -using System.IO.Pipelines; -using System.Threading; namespace Microsoft.AspNetCore.Connections.Features { diff --git a/src/Kestrel.Core/HttpsConnectionAdapterOptions.cs b/src/Kestrel.Core/HttpsConnectionAdapterOptions.cs index 2e2059f962..b4b075209b 100644 --- a/src/Kestrel.Core/HttpsConnectionAdapterOptions.cs +++ b/src/Kestrel.Core/HttpsConnectionAdapterOptions.cs @@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https /// /// /// A callback that will be invoked to dynamically select a server certificate. This is higher priority than ServerCertificate. - /// If SNI is not avialable then the name parameter will be null. + /// If SNI is not available then the name parameter will be null. /// /// /// If the server certificate has an Extended Key Usage extension, the usages must include Server Authentication (OID 1.3.6.1.5.5.7.3.1). diff --git a/src/Kestrel.Core/Internal/BufferReader.cs b/src/Kestrel.Core/Internal/BufferReader.cs index c96889845e..3fb844addb 100644 --- a/src/Kestrel.Core/Internal/BufferReader.cs +++ b/src/Kestrel.Core/Internal/BufferReader.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; -using System.Buffers; using System.Runtime.CompilerServices; namespace System.Buffers diff --git a/src/Kestrel.Core/Internal/ConfigurationReader.cs b/src/Kestrel.Core/Internal/ConfigurationReader.cs index be954d904b..259f2c61b6 100644 --- a/src/Kestrel.Core/Internal/ConfigurationReader.cs +++ b/src/Kestrel.Core/Internal/ConfigurationReader.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal private void ReadEndpointDefaults() { var configSection = _configuration.GetSection(EndpointDefaultsKey); - _endpointDefaults = new EndpointDefaults() + _endpointDefaults = new EndpointDefaults { Protocols = ParseProtocols(configSection[ProtocolsKey]) }; @@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal throw new InvalidOperationException(CoreStrings.FormatEndpointMissingUrl(endpointConfig.Key)); } - var endpoint = new EndpointConfig() + var endpoint = new EndpointConfig { Name = endpointConfig.Key, Url = url, diff --git a/src/Kestrel.Core/Internal/DuplexPipe.cs b/src/Kestrel.Core/Internal/DuplexPipe.cs index adc18c8c7d..7426ebf1fe 100644 --- a/src/Kestrel.Core/Internal/DuplexPipe.cs +++ b/src/Kestrel.Core/Internal/DuplexPipe.cs @@ -1,6 +1,4 @@ -using System.Buffers; - -namespace System.IO.Pipelines +namespace System.IO.Pipelines { internal class DuplexPipe : IDuplexPipe { diff --git a/src/Kestrel.Core/Internal/Http/DateHeaderValueManager.cs b/src/Kestrel.Core/Internal/Http/DateHeaderValueManager.cs index 58dcf88841..61889b1b24 100644 --- a/src/Kestrel.Core/Internal/Http/DateHeaderValueManager.cs +++ b/src/Kestrel.Core/Internal/Http/DateHeaderValueManager.cs @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http Buffer.BlockCopy(_datePreambleBytes, 0, dateBytes, 0, _datePreambleBytes.Length); Encoding.ASCII.GetBytes(dateValue, 0, dateValue.Length, dateBytes, _datePreambleBytes.Length); - var dateValues = new DateHeaderValues() + var dateValues = new DateHeaderValues { Bytes = dateBytes, String = dateValue diff --git a/src/Kestrel.Core/Internal/Http/Http1MessageBody.cs b/src/Kestrel.Core/Internal/Http/Http1MessageBody.cs index 5319e515b0..249180d231 100644 --- a/src/Kestrel.Core/Internal/Http/Http1MessageBody.cs +++ b/src/Kestrel.Core/Internal/Http/Http1MessageBody.cs @@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http catch (OperationCanceledException) { // TryRead can throw OperationCanceledException https://github.com/dotnet/corefx/issues/32029 - // beacuse of buggy logic, this works around that for now + // because of buggy logic, this works around that for now } catch (BadHttpRequestException ex) { @@ -596,9 +596,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } suffixBuffer = suffixBuffer.Slice(0, 2); - var sufixSpan = suffixBuffer.ToSpan(); + var suffixSpan = suffixBuffer.ToSpan(); - if (sufixSpan[1] == '\n') + if (suffixSpan[1] == '\n') { // We consumed the \r\n at the end of the extension, so switch modes. _mode = _inputLength > 0 ? Mode.Data : Mode.Trailer; diff --git a/src/Kestrel.Core/Internal/Http/HttpHeaders.cs b/src/Kestrel.Core/Internal/Http/HttpHeaders.cs index 4a1a474b08..a0a7306d2f 100644 --- a/src/Kestrel.Core/Internal/Http/HttpHeaders.cs +++ b/src/Kestrel.Core/Internal/Http/HttpHeaders.cs @@ -36,8 +36,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { get { - StringValues value; - TryGetValueFast(key, out value); + TryGetValueFast(key, out var value); return value; } set @@ -66,8 +65,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http get { // Unlike the IHeaderDictionary version, this getter will throw a KeyNotFoundException. - StringValues value; - if (!TryGetValueFast(key, out value)) + if (!TryGetValueFast(key, out var value)) { ThrowKeyNotFoundException(); } @@ -197,9 +195,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http bool ICollection>.Contains(KeyValuePair item) { - StringValues value; return - TryGetValueFast(item.Key, out value) && + TryGetValueFast(item.Key, out var value) && value.Equals(item.Value); } @@ -229,9 +226,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http bool ICollection>.Remove(KeyValuePair item) { - StringValues value; return - TryGetValueFast(item.Key, out value) && + TryGetValueFast(item.Key, out var value) && value.Equals(item.Value) && RemoveFast(item.Key); } diff --git a/src/Kestrel.Core/Internal/Http/HttpParser.cs b/src/Kestrel.Core/Internal/Http/HttpParser.cs index 059abead2c..5e31fca253 100644 --- a/src/Kestrel.Core/Internal/Http/HttpParser.cs +++ b/src/Kestrel.Core/Internal/Http/HttpParser.cs @@ -5,7 +5,6 @@ using System; using System.Buffers; using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http @@ -73,9 +72,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http private unsafe void ParseRequestLine(TRequestHandler handler, byte* data, int length) { - int offset; // Get Method and set the offset - var method = HttpUtilities.GetKnownMethod(data, length, out offset); + var method = HttpUtilities.GetKnownMethod(data, length, out var offset); Span customMethod = method == HttpMethod.Custom ? GetUnknownMethod(data, length, out offset) : diff --git a/src/Kestrel.Core/Internal/Http/HttpRequestHeaders.cs b/src/Kestrel.Core/Internal/Http/HttpRequestHeaders.cs index 711f86dc70..cd42a19a1f 100644 --- a/src/Kestrel.Core/Internal/Http/HttpRequestHeaders.cs +++ b/src/Kestrel.Core/Internal/Http/HttpRequestHeaders.cs @@ -5,7 +5,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; @@ -16,8 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { private static long ParseContentLength(string value) { - long parsed; - if (!HeaderUtilities.TryParseNonNegativeInt64(value, out parsed)) + if (!HeaderUtilities.TryParseNonNegativeInt64(value, out var parsed)) { BadHttpRequestException.Throw(RequestRejectionReason.InvalidContentLength, value); } @@ -51,8 +49,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } } - StringValues existing; - Unknown.TryGetValue(key, out existing); + Unknown.TryGetValue(key, out var existing); Unknown[key] = AppendValue(existing, value); } diff --git a/src/Kestrel.Core/Internal/Http/HttpResponseHeaders.cs b/src/Kestrel.Core/Internal/Http/HttpResponseHeaders.cs index 5f9c4b3649..7e8e3a14c4 100644 --- a/src/Kestrel.Core/Internal/Http/HttpResponseHeaders.cs +++ b/src/Kestrel.Core/Internal/Http/HttpResponseHeaders.cs @@ -50,8 +50,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http private static long ParseContentLength(string value) { - long parsed; - if (!HeaderUtilities.TryParseNonNegativeInt64(value, out parsed)) + if (!HeaderUtilities.TryParseNonNegativeInt64(value, out var parsed)) { ThrowInvalidContentLengthException(value); } diff --git a/src/Kestrel.Core/Internal/Http/PathNormalizer.cs b/src/Kestrel.Core/Internal/Http/PathNormalizer.cs index ecc2938e70..6d0513b5b6 100644 --- a/src/Kestrel.Core/Internal/Http/PathNormalizer.cs +++ b/src/Kestrel.Core/Internal/Http/PathNormalizer.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; -using System.Runtime.InteropServices; using System.Text; using Microsoft.AspNetCore.Connections.Abstractions; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; diff --git a/src/Kestrel.Core/Internal/Http2/Http2Connection.cs b/src/Kestrel.Core/Internal/Http2/Http2Connection.cs index 86133de3ce..c8d465f9df 100644 --- a/src/Kestrel.Core/Internal/Http2/Http2Connection.cs +++ b/src/Kestrel.Core/Internal/Http2/Http2Connection.cs @@ -977,7 +977,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 // https://github.com/aspnet/KestrelHttpServer/issues/2051 if (_requestHeaderParsingState != RequestHeaderParsingState.Trailers) { - // Throws BadReqeust for header count limit breaches. + // Throws BadRequest for header count limit breaches. // Throws InvalidOperation for bad encoding. _currentHeadersStream.OnHeader(name, value); } diff --git a/src/Kestrel.Core/Internal/HttpConnection.cs b/src/Kestrel.Core/Internal/HttpConnection.cs index e1eb1278d7..f88c03fbe7 100644 --- a/src/Kestrel.Core/Internal/HttpConnection.cs +++ b/src/Kestrel.Core/Internal/HttpConnection.cs @@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal using (connectionLifetimeNotificationFeature?.ConnectionClosedRequested.Register(state => ((HttpConnection)state).StopProcessingNextRequest(), this)) { - // Ensure TimeoutControl._lastTimestamp is intialized before anything that could set timeouts runs. + // Ensure TimeoutControl._lastTimestamp is initialized before anything that could set timeouts runs. _timeoutControl.Initialize(_systemClock.UtcNow); _context.ConnectionFeatures.Set(_timeoutControl); @@ -375,7 +375,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal public void OnTimeout(TimeoutReason reason) { // In the cases that don't log directly here, we expect the setter of the timeout to also be the input - // reader, so when the read is canceled or arborted, the reader should write the appropriate log. + // reader, so when the read is canceled or aborted, the reader should write the appropriate log. switch (reason) { case TimeoutReason.KeepAlive: diff --git a/src/Kestrel.Core/Internal/HttpConnectionMiddleware.cs b/src/Kestrel.Core/Internal/HttpConnectionMiddleware.cs index 83bca08997..2841259c4f 100644 --- a/src/Kestrel.Core/Internal/HttpConnectionMiddleware.cs +++ b/src/Kestrel.Core/Internal/HttpConnectionMiddleware.cs @@ -3,14 +3,12 @@ using System.Collections.Generic; using System.Net; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal; -using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal { diff --git a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs index e88d71c65c..4abeabc80a 100644 --- a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs +++ b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs @@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal }; } - var sslOptions = new SslServerAuthenticationOptions() + var sslOptions = new SslServerAuthenticationOptions { ServerCertificate = _serverCertificate, ServerCertificateSelectionCallback = selector, diff --git a/src/Kestrel.Core/Internal/IRequestProcessor.cs b/src/Kestrel.Core/Internal/IRequestProcessor.cs index d7385f9b96..b83a56d7ae 100644 --- a/src/Kestrel.Core/Internal/IRequestProcessor.cs +++ b/src/Kestrel.Core/Internal/IRequestProcessor.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Hosting.Server; diff --git a/src/Kestrel.Core/Internal/Infrastructure/ConnectionReference.cs b/src/Kestrel.Core/Internal/Infrastructure/ConnectionReference.cs index 8525fd724e..f577a1353a 100644 --- a/src/Kestrel.Core/Internal/Infrastructure/ConnectionReference.cs +++ b/src/Kestrel.Core/Internal/Infrastructure/ConnectionReference.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Connections; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { diff --git a/src/Kestrel.Core/Internal/Infrastructure/HttpUtilities.cs b/src/Kestrel.Core/Internal/Infrastructure/HttpUtilities.cs index 518c991f74..082e2de0d7 100644 --- a/src/Kestrel.Core/Internal/Infrastructure/HttpUtilities.cs +++ b/src/Kestrel.Core/Internal/Infrastructure/HttpUtilities.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; diff --git a/src/Kestrel.Core/Internal/Infrastructure/KestrelConnection.cs b/src/Kestrel.Core/Internal/Infrastructure/KestrelConnection.cs index f6c9d537b7..cef9f797a8 100644 --- a/src/Kestrel.Core/Internal/Infrastructure/KestrelConnection.cs +++ b/src/Kestrel.Core/Internal/Infrastructure/KestrelConnection.cs @@ -1,10 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Diagnostics.Tracing; -using System.Runtime.CompilerServices; using System.Threading.Tasks; -using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure diff --git a/src/Kestrel.Core/Internal/Infrastructure/KestrelEventSource.cs b/src/Kestrel.Core/Internal/Infrastructure/KestrelEventSource.cs index c14138f0c8..a2a5453379 100644 --- a/src/Kestrel.Core/Internal/Infrastructure/KestrelEventSource.cs +++ b/src/Kestrel.Core/Internal/Infrastructure/KestrelEventSource.cs @@ -4,7 +4,6 @@ using System.Diagnostics.Tracing; using System.Net; using System.Runtime.CompilerServices; -using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; diff --git a/src/Kestrel.Core/ServerAddress.cs b/src/Kestrel.Core/ServerAddress.cs index 0b7f019c85..5650dc6756 100644 --- a/src/Kestrel.Core/ServerAddress.cs +++ b/src/Kestrel.Core/ServerAddress.cs @@ -105,8 +105,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core int portDelimiterEnd = portDelimiterStart + ":".Length; string portString = url.Substring(portDelimiterEnd, pathDelimiterStart - portDelimiterEnd); - int portNumber; - if (int.TryParse(portString, NumberStyles.Integer, CultureInfo.InvariantCulture, out portNumber)) + if (int.TryParse(portString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var portNumber)) { hasSpecifiedPort = true; serverAddress.Host = url.Substring(schemeDelimiterEnd, portDelimiterStart - schemeDelimiterEnd); diff --git a/src/Kestrel.Transport.Abstractions/Internal/IApplicationTransportFeature.cs b/src/Kestrel.Transport.Abstractions/Internal/IApplicationTransportFeature.cs index 490cb7f065..8aa8328a6b 100644 --- a/src/Kestrel.Transport.Abstractions/Internal/IApplicationTransportFeature.cs +++ b/src/Kestrel.Transport.Abstractions/Internal/IApplicationTransportFeature.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Buffers; using System.IO.Pipelines; -using System.Threading; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal { diff --git a/src/Kestrel.Transport.Abstractions/Internal/ITransportSchedulerFeature.cs b/src/Kestrel.Transport.Abstractions/Internal/ITransportSchedulerFeature.cs index be113bbe10..c4df6d5a37 100644 --- a/src/Kestrel.Transport.Abstractions/Internal/ITransportSchedulerFeature.cs +++ b/src/Kestrel.Transport.Abstractions/Internal/ITransportSchedulerFeature.cs @@ -1,9 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Buffers; using System.IO.Pipelines; -using System.Threading; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal { diff --git a/src/Kestrel.Transport.Abstractions/Internal/TransportConnection.FeatureCollection.cs b/src/Kestrel.Transport.Abstractions/Internal/TransportConnection.FeatureCollection.cs index 1f4a3c62d2..42f151d25d 100644 --- a/src/Kestrel.Transport.Abstractions/Internal/TransportConnection.FeatureCollection.cs +++ b/src/Kestrel.Transport.Abstractions/Internal/TransportConnection.FeatureCollection.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO.Pipelines; using System.Net; using System.Threading; -using System.Threading.Tasks; using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Http.Features; diff --git a/src/Kestrel.Transport.Libuv/Internal/LibuvOutputConsumer.cs b/src/Kestrel.Transport.Libuv/Internal/LibuvOutputConsumer.cs index bd7048c9ac..b488cbcce6 100644 --- a/src/Kestrel.Transport.Libuv/Internal/LibuvOutputConsumer.cs +++ b/src/Kestrel.Transport.Libuv/Internal/LibuvOutputConsumer.cs @@ -3,7 +3,6 @@ using System; using System.IO.Pipelines; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking; diff --git a/src/Kestrel.Transport.Libuv/Internal/LibuvThread.cs b/src/Kestrel.Transport.Libuv/Internal/LibuvThread.cs index 43b8f8912e..a4854e2035 100644 --- a/src/Kestrel.Transport.Libuv/Internal/LibuvThread.cs +++ b/src/Kestrel.Transport.Libuv/Internal/LibuvThread.cs @@ -10,7 +10,6 @@ using System.Runtime.ExceptionServices; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking; using Microsoft.Extensions.Logging; diff --git a/src/Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs b/src/Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs index 1218136148..24d3ee2ff9 100644 --- a/src/Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs +++ b/src/Kestrel.Transport.Libuv/Internal/ListenerPrimary.cs @@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal if (_fileCompletionInfoPtr == IntPtr.Zero) { - var fileCompletionInfo = new FILE_COMPLETION_INFORMATION() { Key = IntPtr.Zero, Port = IntPtr.Zero }; + var fileCompletionInfo = new FILE_COMPLETION_INFORMATION { Key = IntPtr.Zero, Port = IntPtr.Zero }; _fileCompletionInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(fileCompletionInfo)); Marshal.StructureToPtr(fileCompletionInfo, _fileCompletionInfoPtr, false); } diff --git a/src/Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs b/src/Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs index d5452242e6..02596aa9ba 100644 --- a/src/Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs +++ b/src/Kestrel.Transport.Libuv/Internal/Networking/LibuvFunctions.cs @@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin [MethodImpl(MethodImplOptions.NoInlining)] private UvException GetError(int statusCode) { - // Note: method marked as NoInlining so it doesn't bloat either of the two preceeding functions + // Note: method marked as NoInlining so it doesn't bloat either of the two preceding functions // Check and ThrowError and alter their jit heuristics. var errorName = err_name(statusCode); var errorDescription = strerror(statusCode); diff --git a/src/Kestrel.Transport.Libuv/Internal/Networking/SockAddr.cs b/src/Kestrel.Transport.Libuv/Internal/Networking/SockAddr.cs index 96fa624bcd..837bc1fa99 100644 --- a/src/Kestrel.Transport.Libuv/Internal/Networking/SockAddr.cs +++ b/src/Kestrel.Transport.Libuv/Internal/Networking/SockAddr.cs @@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin // Quick calculate the port by mask the field and locate the byte 3 and byte 4 // and then shift them to correct place to form a int. var port = ((int)(_field0 & 0x00FF0000) >> 8) | (int)((_field0 & 0xFF000000) >> 24); - + int family = (int)_field0; if (PlatformApis.IsDarwin) { diff --git a/src/Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs b/src/Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs index 7bb6e0e908..cd191540d5 100644 --- a/src/Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs +++ b/src/Kestrel.Transport.Libuv/Internal/Networking/UvTcpHandle.cs @@ -30,10 +30,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin public void Bind(IPEndPoint endPoint) { - SockAddr addr; var addressText = endPoint.Address.ToString(); - _uv.ip4_addr(addressText, endPoint.Port, out addr, out var error1); + _uv.ip4_addr(addressText, endPoint.Port, out var addr, out var error1); if (error1 != null) { @@ -56,18 +55,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networkin public IPEndPoint GetPeerIPEndPoint() { - SockAddr socketAddress; int namelen = Marshal.SizeOf(); - _uv.tcp_getpeername(this, out socketAddress, ref namelen); + _uv.tcp_getpeername(this, out var socketAddress, ref namelen); return socketAddress.GetIPEndPoint(); } public IPEndPoint GetSockIPEndPoint() { - SockAddr socketAddress; int namelen = Marshal.SizeOf(); - _uv.tcp_getsockname(this, out socketAddress, ref namelen); + _uv.tcp_getsockname(this, out var socketAddress, ref namelen); return socketAddress.GetIPEndPoint(); } diff --git a/test/Kestrel.Core.Tests/BufferReaderTests.cs b/test/Kestrel.Core.Tests/BufferReaderTests.cs index 294f61cdb0..a33071db82 100644 --- a/test/Kestrel.Core.Tests/BufferReaderTests.cs +++ b/test/Kestrel.Core.Tests/BufferReaderTests.cs @@ -102,7 +102,7 @@ namespace System.Buffers.Tests } [Fact] - public void PeekReturnsMinuOneByteInTheEnd() + public void PeekReturnsMinusOneByteInTheEnd() { var reader = new BufferReader(Factory.CreateWithContent(new byte[] { 1, 2 })); Assert.Equal(1, reader.Read()); @@ -221,7 +221,7 @@ namespace System.Buffers.Tests } [Fact] - public void PeekWorkesWithEmptySegments() + public void PeekWorksWithEmptySegments() { var buffer = Factory.CreateWithContent(new byte[] { 1 }); var reader = new BufferReader(buffer); @@ -235,7 +235,7 @@ namespace System.Buffers.Tests } [Fact] - public void WorkesWithEmptyBuffer() + public void WorksWithEmptyBuffer() { var reader = new BufferReader(Factory.CreateWithContent(new byte[] { })); diff --git a/test/Kestrel.Core.Tests/BufferWriterTests.cs b/test/Kestrel.Core.Tests/BufferWriterTests.cs index 4a79901a66..f7792c4167 100644 --- a/test/Kestrel.Core.Tests/BufferWriterTests.cs +++ b/test/Kestrel.Core.Tests/BufferWriterTests.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Xunit; namespace System.IO.Pipelines.Tests diff --git a/test/Kestrel.Core.Tests/ConnectionDispatcherTests.cs b/test/Kestrel.Core.Tests/ConnectionDispatcherTests.cs index a441423b7d..8545a231a1 100644 --- a/test/Kestrel.Core.Tests/ConnectionDispatcherTests.cs +++ b/test/Kestrel.Core.Tests/ConnectionDispatcherTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var tcs = new TaskCompletionSource(); var dispatcher = new ConnectionDispatcher(serviceContext, _ => tcs.Task); - var connection = new Mock() { CallBase = true }.Object; + var connection = new Mock { CallBase = true }.Object; connection.ConnectionClosed = new CancellationToken(canceled: true); dispatcher.OnConnection(connection); @@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var serviceContext = new TestServiceContext(); var dispatcher = new ConnectionDispatcher(serviceContext, _ => Task.CompletedTask); - var mockConnection = new Mock() { CallBase = true }; + var mockConnection = new Mock { CallBase = true }; mockConnection.Object.ConnectionClosed = new CancellationToken(canceled: true); var mockPipeReader = new Mock(); var mockPipeWriter = new Mock(); diff --git a/test/Kestrel.Core.Tests/DateHeaderValueManagerTests.cs b/test/Kestrel.Core.Tests/DateHeaderValueManagerTests.cs index 719d82752c..4e5d76b156 100644 --- a/test/Kestrel.Core.Tests/DateHeaderValueManagerTests.cs +++ b/test/Kestrel.Core.Tests/DateHeaderValueManagerTests.cs @@ -104,9 +104,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var testKestrelTrace = new TestKestrelTrace(); - using (var heatbeat = new Heartbeat(new IHeartbeatHandler[] { dateHeaderValueManager }, systemClock, DebuggerWrapper.Singleton, testKestrelTrace)) + using (var heartbeat = new Heartbeat(new IHeartbeatHandler[] { dateHeaderValueManager }, systemClock, DebuggerWrapper.Singleton, testKestrelTrace)) { - heatbeat.OnHeartbeat(); + heartbeat.OnHeartbeat(); Assert.Equal(now.ToString(Rfc1123DateFormat), dateHeaderValueManager.GetDateHeaderValues().String); } diff --git a/test/Kestrel.Core.Tests/HttpConnectionManagerTests.cs b/test/Kestrel.Core.Tests/HttpConnectionManagerTests.cs index cb201672d0..9e821b6920 100644 --- a/test/Kestrel.Core.Tests/HttpConnectionManagerTests.cs +++ b/test/Kestrel.Core.Tests/HttpConnectionManagerTests.cs @@ -3,11 +3,8 @@ using System; using System.Runtime.CompilerServices; -using Microsoft.AspNetCore.Connections; -using Microsoft.AspNetCore.Server.Kestrel.Core.Internal; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; -using Microsoft.AspNetCore.Testing; using Moq; using Xunit; diff --git a/test/Kestrel.Core.Tests/HttpHeadersTests.cs b/test/Kestrel.Core.Tests/HttpHeadersTests.cs index 2aef432898..26104361bd 100644 --- a/test/Kestrel.Core.Tests/HttpHeadersTests.cs +++ b/test/Kestrel.Core.Tests/HttpHeadersTests.cs @@ -225,9 +225,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests { IDictionary headers = httpHeaders; - StringValues value; - - Assert.False(headers.TryGetValue("Content-Length", out value)); + Assert.False(headers.TryGetValue("Content-Length", out var value)); Assert.Null(httpHeaders.ContentLength); Assert.False(httpHeaders.ContentLength.HasValue); diff --git a/test/Kestrel.Core.Tests/HttpUtilitiesTest.cs b/test/Kestrel.Core.Tests/HttpUtilitiesTest.cs index 7f701696bd..e21c079b91 100644 --- a/test/Kestrel.Core.Tests/HttpUtilitiesTest.cs +++ b/test/Kestrel.Core.Tests/HttpUtilitiesTest.cs @@ -34,8 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var block = new Span(Encoding.ASCII.GetBytes(input)); // Act - HttpMethod knownMethod; - var result = block.GetKnownMethod(out knownMethod, out var length); + var result = block.GetKnownMethod(out var knownMethod, out var length); string toString = null; if (knownMethod != HttpMethod.Custom) @@ -136,7 +135,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests { get { - return new TheoryData() { + return new TheoryData { "z", "1", "y:1", @@ -178,7 +177,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests get { // see https://tools.ietf.org/html/rfc7230#section-5.4 - var data = new TheoryData() { + var data = new TheoryData { "[]", // Too short "[::]", // Too short "[ghijkl]", // Non-hex diff --git a/test/Kestrel.Core.Tests/KestrelServerTests.cs b/test/Kestrel.Core.Tests/KestrelServerTests.cs index 0a8ad65938..35d08b9ec4 100644 --- a/test/Kestrel.Core.Tests/KestrelServerTests.cs +++ b/test/Kestrel.Core.Tests/KestrelServerTests.cs @@ -390,7 +390,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests [Fact] public void StartingServerInitializesHeartbeat() { - var testContext = new TestServiceContext() + var testContext = new TestServiceContext { ServerOptions = { diff --git a/test/Kestrel.Core.Tests/KnownStringsTests.cs b/test/Kestrel.Core.Tests/KnownStringsTests.cs index 75565d04f4..c55520eab9 100644 --- a/test/Kestrel.Core.Tests/KnownStringsTests.cs +++ b/test/Kestrel.Core.Tests/KnownStringsTests.cs @@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.Server.KestrelTests static byte[] _methodOptions = Encoding.ASCII.GetBytes("OPTIONS "); static byte[] _methodTrace = Encoding.ASCII.GetBytes("TRACE \0\0"); - const int MagicNumer = 0x0600000C; - static byte[] _invalidMethod1 = BitConverter.GetBytes((ulong)MagicNumer); + const int MagicNumber = 0x0600000C; + static byte[] _invalidMethod1 = BitConverter.GetBytes((ulong)MagicNumber); static byte[] _invalidMethod2 = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static byte[] _invalidMethod3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static byte[] _invalidMethod4 = Encoding.ASCII.GetBytes("CONNECT_"); diff --git a/test/Kestrel.Core.Tests/ListenOptionsTests.cs b/test/Kestrel.Core.Tests/ListenOptionsTests.cs index 5c21b5eee8..998d0a34a4 100644 --- a/test/Kestrel.Core.Tests/ListenOptionsTests.cs +++ b/test/Kestrel.Core.Tests/ListenOptionsTests.cs @@ -1,10 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Net; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -26,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var localhostListenOptions = new LocalhostListenOptions(1004); localhostListenOptions.ConnectionAdapters.Add(new PassThroughConnectionAdapter()); var serviceProvider = new ServiceCollection().BuildServiceProvider(); - localhostListenOptions.KestrelServerOptions = new KestrelServerOptions() + localhostListenOptions.KestrelServerOptions = new KestrelServerOptions { ApplicationServices = serviceProvider }; diff --git a/test/Kestrel.Core.Tests/MessageBodyTests.cs b/test/Kestrel.Core.Tests/MessageBodyTests.cs index 620f140b77..da210fa84c 100644 --- a/test/Kestrel.Core.Tests/MessageBodyTests.cs +++ b/test/Kestrel.Core.Tests/MessageBodyTests.cs @@ -407,7 +407,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests { var writeCount = 0; var writeTcs = new TaskCompletionSource<(byte[], int, int)>(TaskCreationOptions.RunContinuationsAsynchronously); - var mockDestination = new Mock() { CallBase = true }; + var mockDestination = new Mock { CallBase = true }; mockDestination .Setup(m => m.WriteAsync(It.IsAny(), It.IsAny(), It.IsAny(), CancellationToken.None)) @@ -443,8 +443,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests var bytes = Encoding.ASCII.GetBytes("Hello "); var buffer = http1Connection.RequestBodyPipe.Writer.GetMemory(2048); - ArraySegment segment; - Assert.True(MemoryMarshal.TryGetArray(buffer, out segment)); + Assert.True(MemoryMarshal.TryGetArray(buffer, out ArraySegment segment)); Buffer.BlockCopy(bytes, 0, segment.Array, segment.Offset, bytes.Length); http1Connection.RequestBodyPipe.Writer.Advance(bytes.Length); await http1Connection.RequestBodyPipe.Writer.FlushAsync(); diff --git a/test/Kestrel.Core.Tests/PipeOptionsTests.cs b/test/Kestrel.Core.Tests/PipeOptionsTests.cs index 3643fc44ba..1f5b377360 100644 --- a/test/Kestrel.Core.Tests/PipeOptionsTests.cs +++ b/test/Kestrel.Core.Tests/PipeOptionsTests.cs @@ -1,11 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Buffers; using System.IO.Pipelines; -using System.Threading; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal; -using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal; using Microsoft.AspNetCore.Testing; using Moq; diff --git a/test/Kestrel.InMemory.FunctionalTests/ConnectionAdapterTests.cs b/test/Kestrel.InMemory.FunctionalTests/ConnectionAdapterTests.cs index bcc540d727..a9b3cf0803 100644 --- a/test/Kestrel.InMemory.FunctionalTests/ConnectionAdapterTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/ConnectionAdapterTests.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal; using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport; using Microsoft.AspNetCore.Testing; -using Microsoft.Extensions.Logging.Testing; using Xunit; namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests diff --git a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index 063130c963..600def2cd3 100644 --- a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -1970,7 +1970,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await SendRstStreamAsync(1); // Any paused writes for stream 1 should complete after an RST_STREAM - // even without any preceeding window updates. + // even without any preceding window updates. await _runningStreams[1].Task.DefaultTimeout(); // A connection-level window update allows the non-reset stream to continue. @@ -2771,7 +2771,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } [Fact] - public async Task GOAWAY_Received_ContinuesAppsAwaitingStreamOutputFlowControle() + public async Task GOAWAY_Received_ContinuesAppsAwaitingStreamOutputFlowControl() { var writeTasks = new Task[6]; var initialWindowSize = _helloWorldBytes.Length / 2; diff --git a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs index c8623ced46..50d5255854 100644 --- a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.ExceptionServices; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; @@ -14,7 +13,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Server.Kestrel.Core.Features; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2; -using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; using Xunit; @@ -43,7 +41,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } [Fact] - public async Task HEADERS_Received_InvlaidCustomMethod_Reset() + public async Task HEADERS_Received_InvalidCustomMethod_Reset() { var headers = new[] { @@ -189,7 +187,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } [Fact] - public async Task HEADERS_Received_PathAndQuery_Seperated() + public async Task HEADERS_Received_PathAndQuery_Separated() { await InitializeConnectionAsync(context => { @@ -1343,7 +1341,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } [Fact] - public async Task ApplicationExeption_BeforeFirstWrite_Sends500() + public async Task ApplicationException_BeforeFirstWrite_Sends500() { var headers = new[] { @@ -1380,7 +1378,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests } [Fact] - public async Task ApplicationExeption_AfterFirstWrite_Resets() + public async Task ApplicationException_AfterFirstWrite_Resets() { var headers = new[] { diff --git a/test/Kestrel.InMemory.FunctionalTests/Http2/TlsTests.cs b/test/Kestrel.InMemory.FunctionalTests/Http2/TlsTests.cs index d7d57f567c..f366f1dd0f 100644 --- a/test/Kestrel.InMemory.FunctionalTests/Http2/TlsTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/Http2/TlsTests.cs @@ -55,11 +55,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.Http2 using (var connection = server.CreateConnection()) { var sslStream = new SslStream(connection.Stream); - await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() + await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions { TargetHost = "localhost", RemoteCertificateValidationCallback = (_, __, ___, ____) => true, - ApplicationProtocols = new List() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 }, + ApplicationProtocols = new List { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 }, EnabledSslProtocols = SslProtocols.Tls11, // Intentionally less than the required 1.2 }, CancellationToken.None); diff --git a/test/Kestrel.Tests/ConfigurationReaderTests.cs b/test/Kestrel.Tests/ConfigurationReaderTests.cs index 6d9b58071d..a8b36b29f3 100644 --- a/test/Kestrel.Tests/ConfigurationReaderTests.cs +++ b/test/Kestrel.Tests/ConfigurationReaderTests.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests } [Fact] - public void ReadCertificatesWhenEmptyCertificatsSection_ReturnsEmptyCollection() + public void ReadCertificatesWhenEmptyCertificatesSection_ReturnsEmptyCollection() { var config = new ConfigurationBuilder().AddInMemoryCollection(new[] { @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests } [Fact] - public void ReadCertificatsSection_ReturnsCollection() + public void ReadCertificatesSection_ReturnsCollection() { var config = new ConfigurationBuilder().AddInMemoryCollection(new[] { diff --git a/test/Kestrel.Tests/KestrelConfigurationBuilderTests.cs b/test/Kestrel.Tests/KestrelConfigurationBuilderTests.cs index 587ca4c8d3..96f6f8777f 100644 --- a/test/Kestrel.Tests/KestrelConfigurationBuilderTests.cs +++ b/test/Kestrel.Tests/KestrelConfigurationBuilderTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests var serverOptions = new KestrelServerOptions(); serverOptions.ApplicationServices = new ServiceCollection() .AddLogging() - .AddSingleton(new HostingEnvironment() { ApplicationName = "TestApplication" }) + .AddSingleton(new HostingEnvironment { ApplicationName = "TestApplication" }) .BuildServiceProvider(); return serverOptions; } @@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests } [Fact] - public void Configure_IsReplacable() + public void Configure_IsReplaceable() { var run1 = false; var serverOptions = CreateServerOptions(); diff --git a/test/Kestrel.Transport.FunctionalTests/Http2/H2SpecTests.cs b/test/Kestrel.Transport.FunctionalTests/Http2/H2SpecTests.cs index 138b7fbc48..3bdfbd9929 100644 --- a/test/Kestrel.Transport.FunctionalTests/Http2/H2SpecTests.cs +++ b/test/Kestrel.Transport.FunctionalTests/Http2/H2SpecTests.cs @@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 skip = "https://github.com/aspnet/KestrelHttpServer/issues/2154"; } - dataset.Add(new H2SpecTestCase() + dataset.Add(new H2SpecTestCase { Id = testcase.Item1, Description = testcase.Item2, @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 Skip = skip, }); - dataset.Add(new H2SpecTestCase() + dataset.Add(new H2SpecTestCase { Id = testcase.Item1, Description = testcase.Item2, diff --git a/test/Kestrel.Transport.FunctionalTests/Http2/HandshakeTests.cs b/test/Kestrel.Transport.FunctionalTests/Http2/HandshakeTests.cs index 3b3a047372..0b81846e92 100644 --- a/test/Kestrel.Transport.FunctionalTests/Http2/HandshakeTests.cs +++ b/test/Kestrel.Transport.FunctionalTests/Http2/HandshakeTests.cs @@ -4,7 +4,6 @@ #if NETCOREAPP2_2 using System; -using System.Linq; using System.Net; using System.Net.Http; using System.Net.Security; @@ -36,14 +35,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // We don't want the default SocketsHttpHandler, it doesn't support HTTP/2 yet. - Client = new HttpClient(new WinHttpHandler() + Client = new HttpClient(new WinHttpHandler { ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator }); } } - - [ConditionalFact] + + [ConditionalFact] public async Task TlsAlpnHandshakeSelectsHttp2From1and2() { using (var server = new TestServer(context => diff --git a/test/Kestrel.Transport.FunctionalTests/Http2/ShutdownTests.cs b/test/Kestrel.Transport.FunctionalTests/Http2/ShutdownTests.cs index 64eceae6a5..d1f06974e6 100644 --- a/test/Kestrel.Transport.FunctionalTests/Http2/ShutdownTests.cs +++ b/test/Kestrel.Transport.FunctionalTests/Http2/ShutdownTests.cs @@ -3,7 +3,6 @@ #if NETCOREAPP2_2 -using System; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -38,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // We don't want the default SocketsHttpHandler, it doesn't support HTTP/2 yet. - Client = new HttpClient(new WinHttpHandler() + Client = new HttpClient(new WinHttpHandler { ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator }); diff --git a/test/Kestrel.Transport.FunctionalTests/RequestTests.cs b/test/Kestrel.Transport.FunctionalTests/RequestTests.cs index 1128dfae17..e3f0b9ebb5 100644 --- a/test/Kestrel.Transport.FunctionalTests/RequestTests.cs +++ b/test/Kestrel.Transport.FunctionalTests/RequestTests.cs @@ -177,17 +177,17 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests public async Task CanHandleMultipleConcurrentRequests() { var requestNumber = 0; - var ensureConcurrentReqeustTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var ensureConcurrentRequestTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); using (var server = new TestServer(async context => { if (Interlocked.Increment(ref requestNumber) == 1) { - await ensureConcurrentReqeustTcs.Task.DefaultTimeout(); + await ensureConcurrentRequestTcs.Task.DefaultTimeout(); } else { - ensureConcurrentReqeustTcs.SetResult(null); + ensureConcurrentRequestTcs.SetResult(null); } }, new TestServiceContext(LoggerFactory))) { diff --git a/test/Kestrel.Transport.FunctionalTests/ResponseTests.cs b/test/Kestrel.Transport.FunctionalTests/ResponseTests.cs index e38ea63639..aaa39ba476 100644 --- a/test/Kestrel.Transport.FunctionalTests/ResponseTests.cs +++ b/test/Kestrel.Transport.FunctionalTests/ResponseTests.cs @@ -22,7 +22,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Https; using Microsoft.AspNetCore.Server.Kestrel.Https.Internal; using Microsoft.AspNetCore.Testing; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; using Moq; diff --git a/test/Kestrel.Transport.Libuv.Tests/LibuvConnectionTests.cs b/test/Kestrel.Transport.Libuv.Tests/LibuvConnectionTests.cs index e44f5465b8..c284ec1584 100644 --- a/test/Kestrel.Transport.Libuv.Tests/LibuvConnectionTests.cs +++ b/test/Kestrel.Transport.Libuv.Tests/LibuvConnectionTests.cs @@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests { var mockConnectionDispatcher = new MockConnectionDispatcher(); var mockLibuv = new MockLibuv(); - var transportContext = new TestLibuvTransportContext() { ConnectionDispatcher = mockConnectionDispatcher }; + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = mockConnectionDispatcher }; var transport = new LibuvTransport(mockLibuv, transportContext, null); var thread = new LibuvThread(transport); Task connectionTask = null; @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests { var mockConnectionDispatcher = new MockConnectionDispatcher(); var mockLibuv = new MockLibuv(); - var transportContext = new TestLibuvTransportContext() { ConnectionDispatcher = mockConnectionDispatcher }; + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = mockConnectionDispatcher }; var transport = new LibuvTransport(mockLibuv, transportContext, null); var thread = new LibuvThread(transport); mockConnectionDispatcher.InputOptions = pool => @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests { var mockConnectionDispatcher = new MockConnectionDispatcher(); var mockLibuv = new MockLibuv(); - var transportContext = new TestLibuvTransportContext() { ConnectionDispatcher = mockConnectionDispatcher }; + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = mockConnectionDispatcher }; var transport = new LibuvTransport(mockLibuv, transportContext, null); var thread = new LibuvThread(transport); var mockScheduler = new Mock(); @@ -211,7 +211,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests { var mockConnectionDispatcher = new MockConnectionDispatcher(); var mockLibuv = new MockLibuv(); - var transportContext = new TestLibuvTransportContext() { ConnectionDispatcher = mockConnectionDispatcher }; + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = mockConnectionDispatcher }; var transport = new LibuvTransport(mockLibuv, transportContext, null); var thread = new LibuvThread(transport); diff --git a/test/Kestrel.Transport.Libuv.Tests/LibuvThreadTests.cs b/test/Kestrel.Transport.Libuv.Tests/LibuvThreadTests.cs index 5177420d9c..69daacab35 100644 --- a/test/Kestrel.Transport.Libuv.Tests/LibuvThreadTests.cs +++ b/test/Kestrel.Transport.Libuv.Tests/LibuvThreadTests.cs @@ -5,10 +5,6 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal; using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.TestHelpers; -using Microsoft.AspNetCore.Testing; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Moq; using Xunit; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests @@ -20,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests { var mockConnectionDispatcher = new MockConnectionDispatcher(); var mockLibuv = new MockLibuv(); - var transportContext = new TestLibuvTransportContext() { ConnectionDispatcher = mockConnectionDispatcher }; + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = mockConnectionDispatcher }; var transport = new LibuvTransport(mockLibuv, transportContext, null); var thread = new LibuvThread(transport); var ranOne = false; diff --git a/test/Kestrel.Transport.Libuv.Tests/LibuvTransportFactoryTests.cs b/test/Kestrel.Transport.Libuv.Tests/LibuvTransportFactoryTests.cs index 2db383f941..60d8f55dc6 100644 --- a/test/Kestrel.Transport.Libuv.Tests/LibuvTransportFactoryTests.cs +++ b/test/Kestrel.Transport.Libuv.Tests/LibuvTransportFactoryTests.cs @@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests [InlineData(-1337)] public void StartWithNonPositiveThreadCountThrows(int threadCount) { - var options = new LibuvTransportOptions() { ThreadCount = threadCount }; + var options = new LibuvTransportOptions { ThreadCount = threadCount }; var exception = Assert.Throws(() => new LibuvTransportFactory(Options.Create(options), new LifetimeNotImplemented(), Mock.Of())); diff --git a/test/Kestrel.Transport.Libuv.Tests/LibuvTransportTests.cs b/test/Kestrel.Transport.Libuv.Tests/LibuvTransportTests.cs index 3d51c3c482..abdd8e1c7a 100644 --- a/test/Kestrel.Transport.Libuv.Tests/LibuvTransportTests.cs +++ b/test/Kestrel.Transport.Libuv.Tests/LibuvTransportTests.cs @@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests var serviceContext = new TestServiceContext(); listenOptions.UseHttpServer(listenOptions.ConnectionAdapters, serviceContext, new DummyApplication(TestApp.EchoApp), HttpProtocols.Http1); - var transportContext = new TestLibuvTransportContext() + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = new ConnectionDispatcher(serviceContext, listenOptions.Build()) }; @@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests listenOptions.UseHttpServer(listenOptions.ConnectionAdapters, serviceContext, testApplication, HttpProtocols.Http1); - var transportContext = new TestLibuvTransportContext() + var transportContext = new TestLibuvTransportContext { ConnectionDispatcher = new ConnectionDispatcher(serviceContext, listenOptions.Build()), Options = new LibuvTransportOptions { ThreadCount = threadCount } diff --git a/test/Kestrel.Transport.Libuv.Tests/ListenerPrimaryTests.cs b/test/Kestrel.Transport.Libuv.Tests/ListenerPrimaryTests.cs index 2d906fc2cf..394ea3250a 100644 --- a/test/Kestrel.Transport.Libuv.Tests/ListenerPrimaryTests.cs +++ b/test/Kestrel.Transport.Libuv.Tests/ListenerPrimaryTests.cs @@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests var serviceContextPrimary = new TestServiceContext(); var builderPrimary = new ConnectionBuilder(); builderPrimary.UseHttpServer(serviceContextPrimary, new DummyApplication(c => c.Response.WriteAsync("Primary")), HttpProtocols.Http1); - var transportContextPrimary = new TestLibuvTransportContext() { Log = new LibuvTrace(logger) }; + var transportContextPrimary = new TestLibuvTransportContext { Log = new LibuvTrace(logger) }; transportContextPrimary.ConnectionDispatcher = new ConnectionDispatcher(serviceContextPrimary, builderPrimary.Build()); var serviceContextSecondary = new TestServiceContext @@ -213,7 +213,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests var serviceContextPrimary = new TestServiceContext(); var builderPrimary = new ConnectionBuilder(); builderPrimary.UseHttpServer(serviceContextPrimary, new DummyApplication(c => c.Response.WriteAsync("Primary")), HttpProtocols.Http1); - var transportContextPrimary = new TestLibuvTransportContext() { Log = new LibuvTrace(logger) }; + var transportContextPrimary = new TestLibuvTransportContext { Log = new LibuvTrace(logger) }; transportContextPrimary.ConnectionDispatcher = new ConnectionDispatcher(serviceContextPrimary, builderPrimary.Build()); var serviceContextSecondary = new TestServiceContext diff --git a/test/shared/KestrelTestLoggerProvider.cs b/test/shared/KestrelTestLoggerProvider.cs index 69984f2770..6ae40c70f5 100644 --- a/test/shared/KestrelTestLoggerProvider.cs +++ b/test/shared/KestrelTestLoggerProvider.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Testing @@ -11,7 +10,7 @@ namespace Microsoft.AspNetCore.Testing private readonly ILogger _testLogger; public KestrelTestLoggerProvider(bool throwOnCriticalErrors = true) - : this(new TestApplicationErrorLogger() { ThrowOnCriticalErrors = throwOnCriticalErrors }) + : this(new TestApplicationErrorLogger { ThrowOnCriticalErrors = throwOnCriticalErrors }) { } diff --git a/test/shared/StreamBackedTestConnection.cs b/test/shared/StreamBackedTestConnection.cs index 82ac8a0f5d..11e7925bf5 100644 --- a/test/shared/StreamBackedTestConnection.cs +++ b/test/shared/StreamBackedTestConnection.cs @@ -4,8 +4,6 @@ using System; using System.Diagnostics; using System.IO; -using System.Net; -using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using Xunit; diff --git a/test/shared/TransportTestHelpers/H2SpecCommands.cs b/test/shared/TransportTestHelpers/H2SpecCommands.cs index e299e9a0f2..bf33c519a8 100644 --- a/test/shared/TransportTestHelpers/H2SpecCommands.cs +++ b/test/shared/TransportTestHelpers/H2SpecCommands.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests public static IList> EnumerateTestCases() { var testCases = new List>(); - var processOptions = new ProcessStartInfo() + var processOptions = new ProcessStartInfo { FileName = GetToolLocation(), RedirectStandardOutput = true, @@ -165,11 +165,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests description = string.Empty; return false; } - + public static void RunTest(string testId, int port, bool https, ILogger logger) { var tempFile = Path.GetTempPath() + Guid.NewGuid() + ".xml"; - var processOptions = new ProcessStartInfo() + var processOptions = new ProcessStartInfo { FileName = GetToolLocation(), RedirectStandardOutput = true, diff --git a/test/shared/TransportTestHelpers/TestServer.cs b/test/shared/TransportTestHelpers/TestServer.cs index df73888129..9d3bb0cf06 100644 --- a/test/shared/TransportTestHelpers/TestServer.cs +++ b/test/shared/TransportTestHelpers/TestServer.cs @@ -4,7 +4,6 @@ using System; using System.Linq; using System.Net; -using System.Net.Sockets; using System.Reflection; using System.Threading; using System.Threading.Tasks;