Skip to content

[automated] Merge branch 'release/3.1' => 'master' #16834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7816ef9
Handle synchronous exceptions from partial (#16679)
ryanbrandenburg Nov 1, 2019
41e15c3
Prevent VS warning for empty attribute (#16719)
ryanbrandenburg Nov 1, 2019
da12590
[release/3.1] Update dependencies from 2 repositories (#16742)
dotnet-maestro[bot] Nov 1, 2019
57d21c4
Use new EventId for bad dev cert log (#16720)
halter73 Nov 1, 2019
83a09f6
[release/3.1] Update dependencies from 2 repositories (#16750)
dotnet-maestro[bot] Nov 1, 2019
4d3eccc
Set new HTTPS environment variable when using out of process (#16713)
jkotalik Nov 1, 2019
0ab7883
[release/3.1] Update dependencies from aspnet/EntityFrameworkCore (#1…
dotnet-maestro[bot] Nov 2, 2019
a0ee8b6
[release/3.1] Update dependencies from aspnet/EntityFrameworkCore (#1…
dotnet-maestro[bot] Nov 2, 2019
5709cd9
[release/3.1] Update dependencies from aspnet/EntityFrameworkCore (#1…
dotnet-maestro[bot] Nov 2, 2019
507379d
Update dependencies from https://github.com/aspnet/EntityFrameworkCor…
dotnet-maestro[bot] Nov 2, 2019
d3db300
Update dependencies from https://github.com/aspnet/EntityFrameworkCor…
dotnet-maestro[bot] Nov 2, 2019
fe164cd
Update dependencies from https://github.com/aspnet/EntityFrameworkCor…
dotnet-maestro[bot] Nov 2, 2019
da20a12
[release/3.1] Update dependencies from 2 repositories (#16790)
dotnet-maestro[bot] Nov 3, 2019
e3b971a
Keep Kestrel's connection PipeReader in a consistent state (#16725)
halter73 Nov 4, 2019
1e75cdb
Update dependencies from https://github.com/aspnet/EntityFrameworkCor…
dotnet-maestro[bot] Nov 4, 2019
e8f59e6
Merge pull request #16818 from aspnet/darc-release/3.1-32bd8948-af6c-…
wtgodbe Nov 5, 2019
ea51e63
Merge branch 'master' into merge/release/3.1-to-master
dougbu Nov 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<configuration>
<packageSources>
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<add key="darc-pub-dotnet-corefx-4ac4c03" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-corefx-4ac4c036/nuget/v3/index.json" />
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="aspnet-blazor" value="https://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div id="blazor-error-ui">
An unhandled error has occurred.
<a href class="reload">Reload</a>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
Expand Down
5 changes: 3 additions & 2 deletions src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ private int TryGetHttpsPort()
// 1. Set in the HttpsRedirectionOptions
// 2. HTTPS_PORT environment variable
// 3. IServerAddressesFeature
// 4. Fail if not set
var nullablePort = _config.GetValue<int?>("HTTPS_PORT");
// 4. Fail if not sets

var nullablePort = _config.GetValue<int?>("HTTPS_PORT") ?? _config.GetValue<int?>("ANCM_HTTPS_PORT");
if (nullablePort.HasValue)
{
var port = nullablePort.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public virtual async Task ExecuteAsync(ActionContext context, ContentResult resu
{
response.ContentLength = resolvedContentTypeEncoding.GetByteCount(result.Content);

using (var textWriter = _httpResponseStreamWriterFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
await using (var textWriter = _httpResponseStreamWriterFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
{
await textWriter.WriteAsync(result.Content);

Expand Down
2 changes: 1 addition & 1 deletion src/Mvc/Mvc.Razor/src/RazorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private async Task RenderLayoutAsync(
{
// This means we're writing to a 'real' writer, probably to the actual output stream.
// We're using PagedBufferedTextWriter here to 'smooth' synchronous writes of IHtmlContent values.
using (var writer = _bufferScope.CreateWriter(context.Writer))
await using (var writer = _bufferScope.CreateWriter(context.Writer))
{
await bodyWriter.Buffer.WriteToAsync(writer, _htmlEncoder);
await writer.FlushAsync();
Expand Down
6 changes: 3 additions & 3 deletions src/Mvc/Mvc.ViewFeatures/src/ViewComponentResultExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public virtual async Task ExecuteAsync(ActionContext context, ViewComponentResul

_writerFactory ??= context.HttpContext.RequestServices.GetRequiredService<IHttpResponseStreamWriterFactory>();

using (var writer = _writerFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
await using (var writer = _writerFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
{
var viewContext = new ViewContext(
context,
Expand All @@ -149,8 +149,8 @@ public virtual async Task ExecuteAsync(ActionContext context, ViewComponentResul
}
else
{
using var bufferingStream = new FileBufferingWriteStream();
using (var intermediateWriter = _writerFactory.CreateWriter(bufferingStream, resolvedContentTypeEncoding))
await using var bufferingStream = new FileBufferingWriteStream();
await using (var intermediateWriter = _writerFactory.CreateWriter(bufferingStream, resolvedContentTypeEncoding))
{
viewComponentResult.WriteTo(intermediateWriter, _htmlEncoder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mvc/Mvc.ViewFeatures/src/ViewExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected async Task ExecuteAsync(

OnExecuting(viewContext);

using (var writer = WriterFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
await using (var writer = WriterFactory.CreateWriter(response.Body, resolvedContentTypeEncoding))
{
var view = viewContext.View;

Expand Down
38 changes: 38 additions & 0 deletions src/Mvc/Mvc.ViewFeatures/test/ViewExecutorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,44 @@ public static TheoryData<MediaTypeHeaderValue, string, string> ViewExecutorSetsC
}
}

[Fact]
public async Task ExecuteAsync_ExceptionInSyncContext()
{
// Arrange
var view = CreateView((v) =>
{
v.Writer.Write("xyz");
throw new NotImplementedException("This should be raw!");
});

var context = new DefaultHttpContext();
var stream = new Mock<Stream>();
stream.Setup(s => s.CanWrite).Returns(true);

context.Response.Body = stream.Object;
var actionContext = new ActionContext(
context,
new RouteData(),
new ActionDescriptor());
var viewData = new ViewDataDictionary(new EmptyModelMetadataProvider());

var viewExecutor = CreateViewExecutor();

// Act
var exception = await Assert.ThrowsAsync<NotImplementedException>(async () => await viewExecutor.ExecuteAsync(
actionContext,
view,
viewData,
Mock.Of<ITempDataDictionary>(),
contentType: null,
statusCode: null)
);

// Assert
Assert.Equal("This should be raw!", exception.Message);
stream.Verify(s => s.Write(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>()), Times.Never);
}

[Theory]
[MemberData(nameof(ViewExecutorSetsContentTypeAndEncodingData))]
public async Task ExecuteAsync_SetsContentTypeAndEncoding(
Expand Down
13 changes: 12 additions & 1 deletion src/Mvc/test/Mvc.FunctionalTests/TagHelpersTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ public async Task CanRenderViewsWithTagHelpers(string action)
#endif
}

[Fact]
public async Task GivesCorrectCallstackForSyncronousCalls()
{
// Regression test for https://github.com/aspnet/AspNetCore/issues/15367
// Arrange
var exception = await Assert.ThrowsAsync<HttpRequestException>(async () => await Client.GetAsync("http://localhost/Home/MyHtml"));

// Assert
Assert.Equal("Should be visible", exception.InnerException.InnerException.Message);
}

[Fact]
public async Task CanRenderViewsWithTagHelpersAndUnboundDynamicAttributes_Encoded()
{
Expand Down Expand Up @@ -318,4 +329,4 @@ public async Task EncodersPages_ReturnExpectedContent(string actionName)
#endif
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public IActionResult Help()
return View();
}

public IActionResult MyHtml()
{
return View();
}

public IActionResult ViewComponentTagHelpers()
{
return View();
Expand Down
27 changes: 27 additions & 0 deletions src/Mvc/test/WebSites/TagHelpersWebSite/MyHtmlContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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.IO;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;

namespace TagHelpersWebSite
{
public class MyHtmlContent : IHtmlContent
{
private IHtmlHelper Html { get; }

public MyHtmlContent(IHtmlHelper html)
{
Html = html;
}

public void WriteTo(TextWriter writer, HtmlEncoder encoder)
{
#pragma warning disable MVC1000 // Use of IHtmlHelper.{0} should be avoided.
Html.Partial("_Test").WriteTo(writer, encoder);
#pragma warning restore MVC1000 // Use of IHtmlHelper.{0} should be avoided.
}
}
}
1 change: 1 addition & 0 deletions src/Mvc/test/WebSites/TagHelpersWebSite/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\RazorPagesClassLibrary\RazorPagesClassLibrary.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@(new TagHelpersWebSite.MyHtmlContent(Html))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@{
throw new Exception("Should be visible");
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page "/"
@namespace BlazorServerWeb_CSharp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
@{
Layout = null;
}

Expand All @@ -27,7 +27,7 @@
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href class="reload">Reload</a>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/ProjectTemplates/scripts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ tmp/
CustomHive/
angular/
blazorserver/
blazorwasm/
mvc/
razor/
react/
Expand Down
13 changes: 13 additions & 0 deletions src/ProjectTemplates/scripts/Run-BlazorWasm-Locally.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env pwsh
#requires -version 4

# This script packages, installs and creates a template to help with rapid iteration in the templating area.
[CmdletBinding(PositionalBinding = $false)]
param()

Set-StrictMode -Version 2
$ErrorActionPreference = 'Stop'

. $PSScriptRoot\Test-Template.ps1

Test-Template "blazorwasm" "blazorwasm" "Microsoft.AspnetCore.Blazor.Templates.3.1.0-dev.nupkg" $false
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#define STARTUP_TIME_LIMIT_INCREMENT_IN_MILLISECONDS 5000


HRESULT
SERVER_PROCESS::Initialize(
PROCESS_MANAGER *pProcessManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define ASPNETCORE_IIS_AUTH_ENV_STR L"ASPNETCORE_IIS_HTTPAUTH"
#define ASPNETCORE_IIS_WEBSOCKETS_SUPPORTED_ENV_STR L"ASPNETCORE_IIS_WEBSOCKETS_SUPPORTED"
#define ASPNETCORE_IIS_PHYSICAL_PATH_ENV_STR L"ASPNETCORE_IIS_PHYSICAL_PATH"
#define ASPNETCORE_HTTPS_PORT_ENV_STR L"ASPNETCORE_HTTPS_PORT"
#define ASPNETCORE_ANCM_HTTPS_PORT_ENV_STR L"ASPNETCORE_ANCM_HTTPS_PORT"
#define ASPNETCORE_IIS_AUTH_WINDOWS L"windows;"
#define ASPNETCORE_IIS_AUTH_BASIC L"basic;"
#define ASPNETCORE_IIS_AUTH_ANONYMOUS L"anonymous;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ENVIRONMENT_VAR_HELPERS
environmentVariables.insert_or_assign(ASPNETCORE_IIS_PHYSICAL_PATH_ENV_STR, pApplicationPhysicalPath);
if (pHttpsPort)
{
environmentVariables.try_emplace(ASPNETCORE_HTTPS_PORT_ENV_STR, pHttpsPort);
environmentVariables.try_emplace(ASPNETCORE_ANCM_HTTPS_PORT_ENV_STR, pHttpsPort);
}

std::wstring strIisAuthEnvValue;
Expand Down
57 changes: 51 additions & 6 deletions src/Servers/IIS/IIS/test/Common.FunctionalTests/HttpsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public async Task HttpsHelloWorld(TestVariant variant)
if (DeployerSelector.HasNewHandler &&
DeployerSelector.HasNewShim)
{
// We expect ServerAddress to be set for InProcess and HTTPS_PORT for OutOfProcess
// We expect ServerAddress to be set for InProcess and ANCM_HTTPS_PORT for OutOfProcess
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotalik I resolved a conflict in this file and think I got it right. Please double-check my work against what came from your #16713

if (variant.HostingModel == HostingModel.InProcess)
{
Assert.Equal(deploymentParameters.ApplicationBaseUriHint, await client.GetStringAsync("/ServerAddresses"));
}
else
{
Assert.Equal(port.ToString(), await client.GetStringAsync("/HTTPS_PORT"));
Assert.Equal(port.ToString(), await client.GetStringAsync("/ANCM_HTTPS_PORT"));
}
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public async Task CheckProtocolIsHttp2()
[ConditionalFact]
[RequiresNewHandler]
[RequiresNewShim]
public async Task HttpsPortCanBeOverriden()
public async Task AncmHttpsPortCanBeOverriden()
{
var deploymentParameters = Fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess);

Expand All @@ -125,12 +125,57 @@ public async Task HttpsPortCanBeOverriden()
.SetAttributeValue("bindingInformation", $":{TestPortHelper.GetNextSSLPort()}:localhost");
});

deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_HTTPS_PORT"] = "123";
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_ANCM_HTTPS_PORT"] = "123";

var deploymentResult = await DeployAsync(deploymentParameters);
var client = CreateNonValidatingClient(deploymentResult);

Assert.Equal("123", await client.GetStringAsync("/HTTPS_PORT"));
Assert.Equal("123", await client.GetStringAsync("/ANCM_HTTPS_PORT"));
Assert.Equal("NOVALUE", await client.GetStringAsync("/HTTPS_PORT"));
}

[ConditionalFact]
[RequiresNewShim]
public async Task HttpsRedirectionWorksIn30AndNot22()
{
var port = TestPortHelper.GetNextSSLPort();
var deploymentParameters = Fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess);
deploymentParameters.WebConfigBasedEnvironmentVariables["ENABLE_HTTPS_REDIRECTION"] = "true";
deploymentParameters.ApplicationBaseUriHint = $"http://localhost:{TestPortHelper.GetNextPort()}/";

deploymentParameters.AddServerConfigAction(
element => {
element.Descendants("bindings")
.Single()
.AddAndGetInnerElement("binding", "protocol", "https")
.SetAttributeValue("bindingInformation", $":{port}:localhost");

element.Descendants("access")
.Single()
.SetAttributeValue("sslFlags", "None");
});

var deploymentResult = await DeployAsync(deploymentParameters);
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (a, b, c, d) => true,
AllowAutoRedirect = false
};
var client = new HttpClient(handler)
{
BaseAddress = new Uri(deploymentParameters.ApplicationBaseUriHint)
};

if (DeployerSelector.HasNewHandler)
{
var response = await client.GetAsync("/ANCM_HTTPS_PORT");
Assert.Equal(307, (int)response.StatusCode);
}
else
{
var response = await client.GetAsync("/ANCM_HTTPS_PORT");
Assert.Equal(200, (int)response.StatusCode);
}
}

[ConditionalFact]
Expand Down Expand Up @@ -159,7 +204,7 @@ public async Task MultipleHttpsPortsProduceNoEnvVar()
var deploymentResult = await DeployAsync(deploymentParameters);
var client = CreateNonValidatingClient(deploymentResult);

Assert.Equal("NOVALUE", await client.GetStringAsync("/HTTPS_PORT"));
Assert.Equal("NOVALUE", await client.GetStringAsync("/ANCM_HTTPS_PORT"));
}

[ConditionalFact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" >
<AllowExplicitReference>true</AllowExplicitReference>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" >
<AllowExplicitReference>true</AllowExplicitReference>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" >
<AllowExplicitReference>true</AllowExplicitReference>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Reference Include="Microsoft.AspNetCore.Server.IIS" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.HttpsPolicy" />
<Reference Include="Microsoft.AspNetCore.WebUtilities" />
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<Reference Include="Microsoft.Extensions.Configuration.Json" />
Expand Down
Loading