Skip to content
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

[automated] Merge branch 'release/9.0-rc2' => 'release/9.0' #57975

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
24 changes: 12 additions & 12 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -388,31 +388,31 @@
<Uri>https://github.com/dotnet/winforms</Uri>
<Sha>b1fd89453ed5e3ad91e4f18c9386cac8dade6e36</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="9.0.0-beta.24463.2">
<Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="9.0.0-beta.24466.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bcba6939456aa552554eae9ea9538a039cc98d96</Sha>
<Sha>04b9022eba9c184a8036328af513c22e6949e8b6</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.0.0-preview.8.24456.2">
<Uri>https://github.com/dotnet/extensions</Uri>
Expand Down
8 changes: 4 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@
<NuGetVersioningVersion>6.2.4</NuGetVersioningVersion>
<NuGetFrameworksVersion>6.2.4</NuGetFrameworksVersion>
<!-- Packages from dotnet/arcade -->
<MicrosoftDotNetBuildTasksInstallersVersion>9.0.0-beta.24463.2</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.24463.2</MicrosoftDotNetBuildTasksTemplatingVersion>
<MicrosoftDotNetRemoteExecutorVersion>9.0.0-beta.24463.2</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftSourceBuildIntermediatearcadeVersion>9.0.0-beta.24463.2</MicrosoftSourceBuildIntermediatearcadeVersion>
<MicrosoftDotNetBuildTasksInstallersVersion>9.0.0-beta.24466.2</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.24466.2</MicrosoftDotNetBuildTasksTemplatingVersion>
<MicrosoftDotNetRemoteExecutorVersion>9.0.0-beta.24466.2</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftSourceBuildIntermediatearcadeVersion>9.0.0-beta.24466.2</MicrosoftSourceBuildIntermediatearcadeVersion>
<!-- Packages from dotnet/source-build-externals -->
<MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>9.0.0-alpha.1.24452.1</MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>
<!-- Packages from dotnet/source-build-reference-packages -->
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"jdk": "11"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24463.2",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24463.2"
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24466.2",
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24466.2"
}
}
30 changes: 16 additions & 14 deletions src/Components/WebAssembly/DevServer/src/Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -29,27 +30,28 @@ public static void Configure(IApplicationBuilder app, IConfiguration configurati

app.UseWebAssemblyDebugging();

bool applyCopHeaders = configuration.GetValue<bool>("ApplyCopHeaders");
var webHostEnvironment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
var applyCopHeaders = configuration.GetValue<bool>("ApplyCopHeaders");

if (applyCopHeaders)
app.Use(async (ctx, next) =>
{
app.Use(async (ctx, next) =>
if (ctx.Request.Path.StartsWithSegments("/_framework/blazor.boot.json"))
{
if (ctx.Request.Path.StartsWithSegments("/_framework") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.server.js") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.web.js"))
ctx.Response.Headers.Append("Blazor-Environment", webHostEnvironment.EnvironmentName);
}
else if (applyCopHeaders && ctx.Request.Path.StartsWithSegments("/_framework") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.server.js") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.web.js"))
{
var fileExtension = Path.GetExtension(ctx.Request.Path);
if (string.Equals(fileExtension, ".js", StringComparison.OrdinalIgnoreCase))
{
string fileExtension = Path.GetExtension(ctx.Request.Path);
if (string.Equals(fileExtension, ".js"))
{
// Browser multi-threaded runtime requires cross-origin policy headers to enable SharedArrayBuffer.
ApplyCrossOriginPolicyHeaders(ctx);
}
// Browser multi-threaded runtime requires cross-origin policy headers to enable SharedArrayBuffer.
ApplyCrossOriginPolicyHeaders(ctx);
}
}

await next(ctx);
});
}
await next(ctx);
});

//app.UseBlazorFrameworkFiles();
app.UseRouting();

app.UseStaticFiles(new StaticFileOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public void WebAssemblyConfiguration_Works()

if (_serverFixture.TestTrimmedOrMultithreadingApps)
{
// Verify that the environment gets detected as 'Production'.
Browser.Equal("Production", () => _appElement.FindElement(By.Id("environment")).Text);

// Verify values overriden by an environment specific 'appsettings.$(Environment).json are read
Assert.Equal("Prod key2-value", _appElement.FindElement(By.Id("key2")).Text);

Expand All @@ -47,6 +50,9 @@ public void WebAssemblyConfiguration_Works()
}
else
{
// Verify that the dev server always correctly serves the 'Blazor-Environment: Development' header.
Browser.Equal("Development", () => _appElement.FindElement(By.Id("environment")).Text);

// Verify values overriden by an environment specific 'appsettings.$(Environment).json are read
Assert.Equal("Development key2-value", _appElement.FindElement(By.Id("key2")).Text);

Expand Down
7 changes: 6 additions & 1 deletion src/Installers/Windows/SharedFrameworkBundle/Bundle.wxs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="$(var.BundleName)" Version="$(var.BundleVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.BundleUpgradeCode)">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication LicenseUrl="https://go.microsoft.com/fwlink/?LinkId=329770"
Expand All @@ -11,6 +12,10 @@
<PayloadGroupRef Id="PG_Resources"/>
</BootstrapperApplicationRef>

<util:RegistrySearchRef Id="RemovePreviousVersionRegistryKeySearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeyExistsSearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeySearch"/>

<!-- Ensure upgrades from 3.0.0 preview 1, 2, and 3. Conditioned for the 3.0.0 family. -->
<?if $(var.Version)=3.0.0.0?>
<?if $(var.Platform)=x86?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
</PropertyGroup>

<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixDependencyExtension">
<HintPath>$(WixExtDir)\WixDependencyExtension.dll</HintPath>
<Name>WixDependencyExtension</Name>
Expand All @@ -25,6 +29,7 @@

<ItemGroup>
<Compile Include="Bundle.wxs" />
<Compile Include="$(PkgMicrosoft_DotNet_Build_Tasks_Installers)\build\wix\bundle\upgradePolicies.wxs" />
<Content Include="thm.xml" />
</ItemGroup>

Expand Down
5 changes: 5 additions & 0 deletions src/Installers/Windows/WindowsHostingBundle/Bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<PayloadGroupRef Id="PG_Resources"/>
</BootstrapperApplicationRef>

<!-- Search references for upgrade policy keys -->
<util:RegistrySearchRef Id="RemovePreviousVersionRegistryKeySearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeyExistsSearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeySearch"/>

<!-- Ensure upgrades from 3.0.0 preview 1 and 2 (Preview 3 was not shipped). Conditioned for the 3.0.0 family. Hosting bundle simships x86/x64 so there's
a single set of upgrade codes. -->
<?if $(var.Version)=3.0.0.0?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<Compile Include="Bundle.wxs" />
<Compile Include="DotNetCore.wxs" />
<Compile Include="SharedFramework.wxs" />
<Compile Include="$(PkgMicrosoft_DotNet_Build_Tasks_Installers)\build\wix\bundle\upgradePolicies.wxs" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Installers/Windows/Wix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
NoLogo="true"
Cultures="en-us"
InstallerFile="%(WixInstallerFilesToProcess.Identity)"
AdditionalBasePaths="$(MSBuildProjectDirectory)"
AdditionalBasePaths="$(MSBuildProjectDirectory);$(PkgMicrosoft_DotNet_Build_Tasks_Installers)\build\wix\bundle"
WixExtensions="@(WixExtension)"
Loc="@(EmbeddedResource)"
Sice="$(SuppressIces)"
Expand Down
11 changes: 8 additions & 3 deletions src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ private void UpdateHighestOpenedRequestStreamId(long streamId)
public string ConnectionId => _context.ConnectionId;
public ITimeoutControl TimeoutControl => _context.TimeoutControl;

// The default error value is -1. If it hasn't been changed before abort is called then default to HTTP/3's NoError value.
private Http3ErrorCode Http3ErrorCodeOrNoError => _errorCodeFeature.Error == -1 ? Http3ErrorCode.NoError : (Http3ErrorCode)_errorCodeFeature.Error;

public void StopProcessingNextRequest(ConnectionEndReason reason)
=> StopProcessingNextRequest(serverInitiated: true, reason);

Expand Down Expand Up @@ -505,12 +508,14 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> appl
}
}

var errorCode = Http3ErrorCodeOrNoError;

// Abort active request streams.
lock (_streams)
{
foreach (var stream in _streams.Values)
{
stream.Abort(CreateConnectionAbortError(error, clientAbort), (Http3ErrorCode)_errorCodeFeature.Error);
stream.Abort(CreateConnectionAbortError(error, clientAbort), errorCode);
}
}

Expand Down Expand Up @@ -546,7 +551,7 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> appl
}

// Complete
Abort(CreateConnectionAbortError(error, clientAbort), (Http3ErrorCode)_errorCodeFeature.Error, reason);
Abort(CreateConnectionAbortError(error, clientAbort), errorCode, reason);

// Wait for active requests to complete.
while (_activeRequestCount > 0)
Expand Down Expand Up @@ -905,7 +910,7 @@ public void OnInputOrOutputCompleted()
TryStopAcceptingStreams();

// Abort the connection using the error code the client used. For a graceful close, this should be H3_NO_ERROR.
Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient), (Http3ErrorCode)_errorCodeFeature.Error, ConnectionEndReason.TransportCompleted);
Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient), Http3ErrorCodeOrNoError, ConnectionEndReason.TransportCompleted);
}

internal WebTransportSession OpenNewWebTransportSession(Http3Stream http3Stream)
Expand Down
2 changes: 1 addition & 1 deletion src/Servers/Kestrel/shared/test/Http3/Http3InMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void TriggerTick(TimeSpan timeSpan = default)

public async Task InitializeConnectionAsync(RequestDelegate application)
{
MultiplexedConnectionContext = new TestMultiplexedConnectionContext(this)
MultiplexedConnectionContext ??= new TestMultiplexedConnectionContext(this)
{
ConnectionId = "TEST"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,84 @@ await Http3Api.InitializeConnectionAsync(async c =>
await tcs.Task;
}

[Fact]
public async Task ErrorCodeIsValidOnConnectionTimeout()
{
// This test loosely repros the scenario in https://github.com/dotnet/aspnetcore/issues/57933.
// In particular, there's a request from the server and, once a response has been sent,
// the (simulated) transport throws a QuicException that surfaces through AcceptAsync.
// This test confirms that Http3Connection.ProcessRequestsAsync doesn't (indirectly) cause
// IProtocolErrorCodeFeature.Error to be set to (or left at) -1, which System.Net.Quic will
// not accept.

// Used to signal that a request has been sent and a response has been received
var requestTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
// Used to signal that the connection context has been aborted
var abortTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);

// InitializeConnectionAsync consumes the connection context, so set it first
Http3Api.MultiplexedConnectionContext = new ThrowingMultiplexedConnectionContext(Http3Api, skipCount: 2, requestTcs, abortTcs);
await Http3Api.InitializeConnectionAsync(_echoApplication);

await Http3Api.CreateControlStream();
await Http3Api.GetInboundControlStream();
var requestStream = await Http3Api.CreateRequestStream(Headers, endStream: true);
var responseHeaders = await requestStream.ExpectHeadersAsync();

await requestStream.ExpectReceiveEndOfStream();
await requestStream.OnDisposedTask.DefaultTimeout();

requestTcs.SetResult();

// By the time the connection context is aborted, the error code feature has been updated
await abortTcs.Task.DefaultTimeout();

Http3Api.CloseServerGracefully();

var errorCodeFeature = Http3Api.MultiplexedConnectionContext.Features.Get<IProtocolErrorCodeFeature>();
Assert.InRange(errorCodeFeature.Error, 0, (1L << 62) - 1); // Valid range for HTTP/3 error codes
}

private sealed class ThrowingMultiplexedConnectionContext : TestMultiplexedConnectionContext
{
private int _skipCount;
private readonly TaskCompletionSource _requestTcs;
private readonly TaskCompletionSource _abortTcs;

/// <summary>
/// After <paramref name="skipCount"/> calls to <see cref="AcceptAsync"/>, the next call will throw a <see cref="QuicException"/>
/// (after waiting for <see cref="_requestTcs"/> to be set).
///
/// <paramref name="abortTcs"/> lets this type signal that <see cref="Abort"/> has been called.
/// </summary>
public ThrowingMultiplexedConnectionContext(Http3InMemory testBase, int skipCount, TaskCompletionSource requestTcs, TaskCompletionSource abortTcs)
: base(testBase)
{
_skipCount = skipCount;
_requestTcs = requestTcs;
_abortTcs = abortTcs;
}

public override async ValueTask<ConnectionContext> AcceptAsync(CancellationToken cancellationToken = default)
{
if (_skipCount-- <= 0)
{
await _requestTcs.Task.DefaultTimeout();
throw new System.Net.Quic.QuicException(
System.Net.Quic.QuicError.ConnectionTimeout,
applicationErrorCode: null,
"Connection timed out waiting for a response from the peer.");
}
return await base.AcceptAsync(cancellationToken);
}

public override void Abort(ConnectionAbortedException abortReason)
{
_abortTcs.SetResult();
base.Abort(abortReason);
}
}

private async Task<ConnectionContext> MakeRequestAsync(int index, KeyValuePair<string, string>[] headers, bool sendData, bool waitForServerDispose)
{
var requestStream = await Http3Api.CreateRequestStream(headers, endStream: !sendData);
Expand Down
Loading