Merge branch 'release/3.0-preview7' => 'master'

This commit is contained in:
Doug Bunting 2019-07-04 22:24:35 -07:00
commit 27ee4aa741
No known key found for this signature in database
GPG Key ID: EE41520987982C03
13 changed files with 108 additions and 32 deletions

2
.gitignore vendored
View File

@ -39,4 +39,4 @@ modules/
launchSettings.json launchSettings.json
msbuild.ProjectImports.zip msbuild.ProjectImports.zip
StyleCop.Cache StyleCop.Cache
UpgradeLog.htm UpgradeLog.htm

View File

@ -125,6 +125,11 @@
<TargetingPackVersion Condition="'%(TargetFramework)' == 'netstandard2.1' and '$(IsServicingBuild)' != 'true'">$(NETStandardLibraryRefPackageVersion)</TargetingPackVersion> <TargetingPackVersion Condition="'%(TargetFramework)' == 'netstandard2.1' and '$(IsServicingBuild)' != 'true'">$(NETStandardLibraryRefPackageVersion)</TargetingPackVersion>
</KnownFrameworkReference> </KnownFrameworkReference>
<!-- Track compiler separately from Arcade.-->
<PackageReference Include="Microsoft.Net.Compilers.Toolset"
Version="$(MicrosoftNetCompilersToolsetPackageVersion)"
PrivateAssets="all"
IsImplicitlyDefined="true" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition=" '$(CopySymbolsToArtifacts)' == 'true' AND '$(TargetFramework)' != '' "> <PropertyGroup Condition=" '$(CopySymbolsToArtifacts)' == 'true' AND '$(TargetFramework)' != '' ">

View File

@ -420,5 +420,9 @@
<Uri>https://github.com/aspnet/Extensions</Uri> <Uri>https://github.com/aspnet/Extensions</Uri>
<Sha>0538d10f82468dd7539d9abdb7b60c378989e0a6</Sha> <Sha>0538d10f82468dd7539d9abdb7b60c378989e0a6</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.3.0-beta1-19351-01">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>c91adff42c488aef2c2c532a7b053fb55e0c16ea</Sha>
</Dependency>
</ToolsetDependencies> </ToolsetDependencies>
</Dependencies> </Dependencies>

View File

@ -33,8 +33,6 @@
<PropertyGroup Label="Arcade settings"> <PropertyGroup Label="Arcade settings">
<!-- Opt-in to Arcade tools for building VSIX projects. --> <!-- Opt-in to Arcade tools for building VSIX projects. -->
<UsingToolVSSDK>true</UsingToolVSSDK> <UsingToolVSSDK>true</UsingToolVSSDK>
<!-- Opt-in to using the version of the Roslyn compiler bundled with Arcade. -->
<UsingToolMicrosoftNetCompilers Condition="'$(MSBuildProjectExtension)' == '.csproj' or '$(MSBuildProjectExtension)' == '.fsproj' or '$(MSBuildProjectExtension)' == '.vbproj'">true</UsingToolMicrosoftNetCompilers>
<!-- Only use Microsoft.NETFramework.ReferenceAssemblies on non-windows builds. Using this on Windows breaks MVC runtime compilation. --> <!-- Only use Microsoft.NETFramework.ReferenceAssemblies on non-windows builds. Using this on Windows breaks MVC runtime compilation. -->
<UsingToolNetFrameworkReferenceAssemblies Condition="'$(OS)' != 'Windows_NT'">true</UsingToolNetFrameworkReferenceAssemblies> <UsingToolNetFrameworkReferenceAssemblies Condition="'$(OS)' != 'Windows_NT'">true</UsingToolNetFrameworkReferenceAssemblies>
<!-- Disable XLIFF tasks --> <!-- Disable XLIFF tasks -->
@ -53,6 +51,8 @@
<PropertyGroup Label="Automated"> <PropertyGroup Label="Automated">
<!-- Packages from dotnet/arcade --> <!-- Packages from dotnet/arcade -->
<MicrosoftDotNetGenAPIPackageVersion>1.0.0-beta.19323.4</MicrosoftDotNetGenAPIPackageVersion> <MicrosoftDotNetGenAPIPackageVersion>1.0.0-beta.19323.4</MicrosoftDotNetGenAPIPackageVersion>
<!-- Packages from dotnet/roslyn -->
<MicrosoftNetCompilersToolsetPackageVersion>3.3.0-beta1-19351-01</MicrosoftNetCompilersToolsetPackageVersion>
<!-- Packages from dotnet/core-setup --> <!-- Packages from dotnet/core-setup -->
<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview8-27903-07</MicrosoftExtensionsDependencyModelPackageVersion> <MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview8-27903-07</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>3.0.0-preview8-27903-07</MicrosoftNETCoreAppRefPackageVersion> <MicrosoftNETCoreAppRefPackageVersion>3.0.0-preview8-27903-07</MicrosoftNETCoreAppRefPackageVersion>
@ -217,7 +217,7 @@
<CastleCorePackageVersion>4.2.1</CastleCorePackageVersion> <CastleCorePackageVersion>4.2.1</CastleCorePackageVersion>
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion> <FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
<GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion> <GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion>
<GrpcAspNetCorePackageVersion>0.1.22-pre1</GrpcAspNetCorePackageVersion> <GrpcAspNetCorePackageVersion>0.1.22-pre2</GrpcAspNetCorePackageVersion>
<IdentityServer4AspNetIdentityPackageVersion>3.0.0-preview3.4</IdentityServer4AspNetIdentityPackageVersion> <IdentityServer4AspNetIdentityPackageVersion>3.0.0-preview3.4</IdentityServer4AspNetIdentityPackageVersion>
<IdentityServer4EntityFrameworkPackageVersion>3.0.0-preview3.4</IdentityServer4EntityFrameworkPackageVersion> <IdentityServer4EntityFrameworkPackageVersion>3.0.0-preview3.4</IdentityServer4EntityFrameworkPackageVersion>
<IdentityServer4PackageVersion>3.0.0-preview3.4</IdentityServer4PackageVersion> <IdentityServer4PackageVersion>3.0.0-preview3.4</IdentityServer4PackageVersion>
@ -255,6 +255,10 @@
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json; https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev; https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev;
</RestoreSources> </RestoreSources>
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true' AND $(MicrosoftNetCompilersToolsetPackageVersion.Contains('-')) ">
$(RestoreSources);
https://dotnet.myget.org/F/roslyn/api/v3/index.json;
</RestoreSources>
<!-- TODO remove this once we move Microsoft.Internal.AspNetCore.H2Spec.All to a non-myget feed --> <!-- TODO remove this once we move Microsoft.Internal.AspNetCore.H2Spec.All to a non-myget feed -->
<RestoreSources> <RestoreSources>
$(RestoreSources); $(RestoreSources);

View File

@ -1142,7 +1142,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations
Assert.Equal(initialValue, context.ValidationMetadata.IsRequired); Assert.Equal(initialValue, context.ValidationMetadata.IsRequired);
} }
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public void CreateValidationMetadata_InfersRequiredAttribute_NoNonNullableProperty() public void CreateValidationMetadata_InfersRequiredAttribute_NoNonNullableProperty()
{ {
// Arrange // Arrange
@ -1325,7 +1325,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations
Assert.Same(attribute, validatorMetadata); Assert.Same(attribute, validatorMetadata);
} }
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public void IsNonNullable_FindsNonNullableProperty() public void IsNonNullable_FindsNonNullableProperty()
{ {
// Arrange // Arrange
@ -1353,7 +1353,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations
Assert.False(result); Assert.False(result);
} }
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public void IsNonNullable_FindsNonNullableParameter() public void IsNonNullable_FindsNonNullableParameter()
{ {
// Arrange // Arrange

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
private HttpClient Client { get; set; } private HttpClient Client { get; set; }
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public async Task CanUseNonNullableReferenceType_WithController_OmitData_ValidationErrors() public async Task CanUseNonNullableReferenceType_WithController_OmitData_ValidationErrors()
{ {
// Arrange // Arrange

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
} }
#nullable restore #nullable restore
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public async Task BindProperty_WithNonNullableReferenceType_NoData_ValidationError() public async Task BindProperty_WithNonNullableReferenceType_NoData_ValidationError()
{ {
// Arrange // Arrange
@ -112,7 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
} }
#nullable restore #nullable restore
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public async Task BindProperty_WithNonNullableReferenceType_NoData_ValidationError_CustomMessage() public async Task BindProperty_WithNonNullableReferenceType_NoData_ValidationError_CustomMessage()
{ {
// Arrange // Arrange
@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
} }
#nullable restore #nullable restore
[Fact] [Fact(Skip = "https://github.com/aspnet/AspNetCore/issues/11828")]
public async Task BindParameter_WithNonNullableReferenceType_NoData_ValidationError() public async Task BindParameter_WithNonNullableReferenceType_NoData_ValidationError()
{ {
// Arrange // Arrange

View File

@ -3,7 +3,7 @@
"GrpcService-CSharp": { "GrpcService-CSharp": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "https://localhost:50051", "applicationUrl": "https://localhost:5001",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

View File

@ -5,5 +5,10 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
}
} }

View File

@ -2,17 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
#if (!NoAuth)
using Microsoft.AspNetCore.Authorization;
#endif
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Company.WebApplication1.Controllers namespace Company.WebApplication1.Controllers
{ {
#if (!NoAuth)
[Authorize]
#endif
[ApiController] [ApiController]
[Route("[controller]")] [Route("[controller]")]
public class WeatherForecastController : ControllerBase public class WeatherForecastController : ControllerBase

View File

@ -3,8 +3,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.E2ETesting; using Microsoft.AspNetCore.E2ETesting;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Templates.Test.Helpers; using Templates.Test.Helpers;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
@ -19,7 +17,6 @@ namespace Templates.Test.SpaTemplateTest
} }
[Fact] [Fact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2407", FlakyOn.AzP.Windows)]
public Task ReactReduxTemplate_Works_NetCore() public Task ReactReduxTemplate_Works_NetCore()
=> SpaTemplateImplAsync("reactredux", "reactredux", useLocalDb: false, usesAuth: false); => SpaTemplateImplAsync("reactredux", "reactredux", useLocalDb: false, usesAuth: false);
} }

View File

@ -55,7 +55,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
// and append the end terminator. // and append the end terminator.
private bool _autoChunk; private bool _autoChunk;
private bool _suffixSent;
// We rely on the TimingPipeFlusher to give us ValueTasks that can be safely awaited multiple times.
private bool _writeStreamSuffixCalled;
private ValueTask<FlushResult> _writeStreamSuffixValueTask;
private int _advancedBytesForChunk; private int _advancedBytesForChunk;
private Memory<byte> _currentChunkMemory; private Memory<byte> _currentChunkMemory;
private bool _currentChunkMemoryUpdated; private bool _currentChunkMemoryUpdated;
@ -113,15 +117,28 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{ {
lock (_contextLock) lock (_contextLock)
{ {
if (_suffixSent || !_autoChunk) if (_writeStreamSuffixCalled)
{ {
_suffixSent = true; // If WriteStreamSuffixAsync has already been called, no-op and return the previously returned ValueTask.
return FlushAsync(); return _writeStreamSuffixValueTask;
} }
_suffixSent = true; if (_autoChunk)
var writer = new BufferWriter<PipeWriter>(_pipeWriter); {
return WriteAsyncInternal(ref writer, EndChunkedResponseBytes); var writer = new BufferWriter<PipeWriter>(_pipeWriter);
_writeStreamSuffixValueTask = WriteAsyncInternal(ref writer, EndChunkedResponseBytes);
}
else if (_unflushedBytes > 0)
{
_writeStreamSuffixValueTask = FlushAsync();
}
else
{
_writeStreamSuffixValueTask = default;
}
_writeStreamSuffixCalled = true;
return _writeStreamSuffixValueTask;
} }
} }
@ -510,7 +527,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
// Cleared in sequential address ascending order // Cleared in sequential address ascending order
_currentMemoryPrefixBytes = 0; _currentMemoryPrefixBytes = 0;
_autoChunk = false; _autoChunk = false;
_suffixSent = false; _writeStreamSuffixCalled = false;
_writeStreamSuffixValueTask = default;
_currentChunkMemoryUpdated = false; _currentChunkMemoryUpdated = false;
_startCalled = false; _startCalled = false;
} }
@ -701,7 +719,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
[StackTraceHidden] [StackTraceHidden]
private void ThrowIfSuffixSent() private void ThrowIfSuffixSent()
{ {
if (_suffixSent) if (_writeStreamSuffixCalled)
{ {
throw new InvalidOperationException("Writing is not allowed after writer was completed."); throw new InvalidOperationException("Writing is not allowed after writer was completed.");
} }

View File

@ -2905,7 +2905,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
var expectedString = new string('a', expectedLength); var expectedString = new string('a', expectedLength);
await using (var server = new TestServer(async httpContext => await using (var server = new TestServer(async httpContext =>
{ {
httpContext.Response.Headers["Content-Length"] = new[] { expectedLength.ToString() }; httpContext.Response.ContentLength = expectedLength;
await httpContext.Response.WriteAsync(expectedString); await httpContext.Response.WriteAsync(expectedString);
Assert.True(httpContext.Response.HasStarted); Assert.True(httpContext.Response.HasStarted);
}, testContext)) }, testContext))
@ -2927,6 +2927,55 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
} }
} }
[Fact]
public async Task UnflushedContentLengthResponseIsFlushedAutomatically()
{
var testContext = new TestServiceContext(LoggerFactory);
var expectedLength = 100000;
var expectedString = new string('a', expectedLength);
void WriteStringWithoutFlushing(PipeWriter writer, string content)
{
var encoder = Encoding.ASCII.GetEncoder();
var encodedLength = Encoding.ASCII.GetByteCount(expectedString);
var source = expectedString.AsSpan();
var completed = false;
while (!completed)
{
encoder.Convert(source, writer.GetSpan(), flush: source.Length == 0, out var charsUsed, out var bytesUsed, out completed);
writer.Advance(bytesUsed);
source = source.Slice(charsUsed);
}
}
await using (var server = new TestServer(httpContext =>
{
httpContext.Response.ContentLength = expectedLength;
WriteStringWithoutFlushing(httpContext.Response.BodyWriter, expectedString);
Assert.False(httpContext.Response.HasStarted);
return Task.CompletedTask;
}, testContext))
{
using (var connection = server.CreateConnection())
{
await connection.Send(
"GET / HTTP/1.1",
"Host:",
"",
"");
await connection.Receive(
"HTTP/1.1 200 OK",
$"Date: {testContext.DateHeaderValue}",
$"Content-Length: {expectedLength}",
"",
expectedString);
}
}
}
[Fact] [Fact]
public async Task StartAsyncAndFlushWorks() public async Task StartAsyncAndFlushWorks()
{ {