Skip to content

[automated] Merge branch 'release/6.0-rc2' => 'release/6.0' #36901

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
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions eng/targets/Wix.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProductVersion>3.14</ProductVersion>
<WixVersion>3.14.0-dotnet</WixVersion>
<WixVersion>1.0.0-v3.14.0.4118</WixVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -20,7 +20,7 @@
<Import Project="$(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).*.props" Condition="'$(_ProjectExtensionsWereImported)' != 'true'" />

<ItemGroup>
<PackageReference Include="Wix" Version="$(WixVersion)" />
<PackageReference Include="Microsoft.Signed.Wix" Version="$(WixVersion)" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/tools/RepoTasks/RepoTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="Wix" Version="3.11.1" />
<PackageReference Include="Microsoft.Signed.Wix" Version="1.0.0-v3.14.0.4118" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

<Reference Include="Microsoft.Build" />
Expand Down
7 changes: 4 additions & 3 deletions src/Http/Http.Results/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ static Microsoft.AspNetCore.Http.Results.LocalRedirect(string! localUrl, bool pe
static Microsoft.AspNetCore.Http.Results.NoContent() -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.NotFound(object? value = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Ok(object? value = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Problem(string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Problem(string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, System.Collections.Generic.IDictionary<string!, object?>? extensions = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Problem(Microsoft.AspNetCore.Mvc.ProblemDetails! problemDetails) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Redirect(string! url, bool permanent = false, bool preserveMethod = false) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.RedirectToRoute(string? routeName = null, object? routeValues = null, bool permanent = false, bool preserveMethod = false, string? fragment = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.SignIn(System.Security.Claims.ClaimsPrincipal! principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties? properties = null, string? authenticationScheme = null) -> Microsoft.AspNetCore.Http.IResult!
Expand All @@ -30,6 +31,6 @@ static Microsoft.AspNetCore.Http.Results.Stream(System.IO.Stream! stream, string
static Microsoft.AspNetCore.Http.Results.Text(string! content, string? contentType = null, System.Text.Encoding? contentEncoding = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Unauthorized() -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.UnprocessableEntity(object? error = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.ValidationProblem(System.Collections.Generic.IDictionary<string!, string![]!>! errors, string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.ValidationProblem(System.Collections.Generic.IDictionary<string!, string![]!>! errors, string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, System.Collections.Generic.IDictionary<string!, object?>? extensions = null) -> Microsoft.AspNetCore.Http.IResult!
static Microsoft.AspNetCore.Http.Results.Extensions.get -> Microsoft.AspNetCore.Http.IResultExtensions!
Microsoft.AspNetCore.Http.IResultExtensions
Microsoft.AspNetCore.Http.IResultExtensions
44 changes: 39 additions & 5 deletions src/Http/Http.Results/src/Results.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,23 +471,46 @@ public static IResult UnprocessableEntity(object? error = null)
/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param>
/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param>
/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param>
/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
/// <returns>The created <see cref="IResult"/> for the response.</returns>
public static IResult Problem(
string? detail = null,
string? instance = null,
int? statusCode = null,
string? title = null,
string? type = null)
string? type = null,
IDictionary<string, object?>? extensions = null)
{
var problemDetails = new ProblemDetails
{
Detail = detail,
Instance = instance,
Status = statusCode,
Title = title,
Type = type
Type = type,
};

if (extensions is not null)
{
foreach (var extension in extensions)
{
problemDetails.Extensions.Add(extension);
}
}

return new ObjectResult(problemDetails)
{
ContentType = "application/problem+json",
};
}

/// <summary>
/// Produces a <see cref="ProblemDetails"/> response.
/// </summary>
/// <param name="problemDetails">The <see cref="ProblemDetails"/> object to produce a response from.</param>
/// <returns>The created <see cref="IResult"/> for the response.</returns>
public static IResult Problem(ProblemDetails problemDetails)
{
return new ObjectResult(problemDetails)
{
ContentType = "application/problem+json",
Expand All @@ -502,25 +525,36 @@ public static IResult Problem(
/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param>
/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param>
/// <param name="statusCode">The status code.</param>
/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param>
/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param>
/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param>
/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
/// <returns>The created <see cref="IResult"/> for the response.</returns>
public static IResult ValidationProblem(
IDictionary<string, string[]> errors,
string? detail = null,
string? instance = null,
int? statusCode = null,
string? title = null,
string? type = null)
string? type = null,
IDictionary<string, object?>? extensions = null)
{
var problemDetails = new HttpValidationProblemDetails(errors)
{
Detail = detail,
Instance = instance,
Title = title,
Type = type,
Status = statusCode,
};

problemDetails.Title = title ?? problemDetails.Title;

if (extensions is not null)
{
foreach (var extension in extensions)
{
problemDetails.Extensions.Add(extension);
}
}

return new ObjectResult(problemDetails)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Http/samples/MinimalSample/MinimalSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<Reference Include="Microsoft.AspNetCore" />
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.Http" />
<Reference Include="Microsoft.AspNetCore.Http.Results" />
<!-- Mvc.Core is referenced only for its attributes -->
<Reference Include="Microsoft.AspNetCore.Mvc.Core" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
Expand Down
27 changes: 21 additions & 6 deletions src/Http/samples/MinimalSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Mvc;

var app = WebApplication.Create(args);

Expand All @@ -13,12 +11,29 @@
}

string Plaintext() => "Hello, World!";
app.MapGet("/plaintext", (Func<string>)Plaintext);
app.MapGet("/plaintext", Plaintext);


object Json() => new { message = "Hello, World!" };
app.MapGet("/json", (Func<object>)Json);
app.MapGet("/json", Json);

string SayHello(string name) => $"Hello, {name}!";
app.MapGet("/hello/{name}", (Func<string, string>)SayHello);
app.MapGet("/hello/{name}", SayHello);

var extensions = new Dictionary<string, object>() { { "traceId", "traceId123" } };

app.MapGet("/problem", () =>
Results.Problem(statusCode: 500, extensions: extensions));

app.MapGet("/problem-object", () =>
Results.Problem(new ProblemDetails() { Status = 500, Extensions = { { "traceId", "traceId123"} } }));

var errors = new Dictionary<string, string[]>();

app.MapGet("/validation-problem", () =>
Results.ValidationProblem(errors, statusCode: 400, extensions: extensions));

app.MapGet("/validation-problem-object", () =>
Results.Problem(new HttpValidationProblemDetails(errors) { Status = 400, Extensions = { { "traceId", "traceId123"}}}));

app.Run();
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ private Http3StreamContext CreateHttpStreamContext(ConnectionContext streamConte
{
var httpConnectionContext = new Http3StreamContext(
_multiplexedContext.ConnectionId,
#pragma warning disable CA2252 // Preview Features
HttpProtocols.Http3,
#pragma warning restore CA2252
_context.AltSvcHeader,
_multiplexedContext,
_context.ServiceContext,
Expand Down Expand Up @@ -537,7 +539,9 @@ private async ValueTask<Http3ControlStream> CreateNewUnidirectionalStreamAsync<T
var streamContext = await _multiplexedContext.ConnectAsync(features);
var httpConnectionContext = new Http3StreamContext(
_multiplexedContext.ConnectionId,
#pragma warning disable CA2252 // Preview Features
HttpProtocols.Http3,
#pragma warning restore CA2252
_context.AltSvcHeader,
_multiplexedContext,
_context.ServiceContext,
Expand Down
6 changes: 6 additions & 0 deletions src/Servers/Kestrel/Core/src/Internal/HttpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> http
requestProcessor = new Http2Connection((HttpConnectionContext)_context);
_protocolSelectionState = ProtocolSelectionState.Selected;
break;
#pragma warning disable CA2252 // Preview Features
case HttpProtocols.Http3:
requestProcessor = new Http3Connection((HttpMultiplexedConnectionContext)_context);
#pragma warning restore CA2252
_protocolSelectionState = ProtocolSelectionState.Selected;
break;
case HttpProtocols.None:
Expand Down Expand Up @@ -205,7 +207,9 @@ private HttpProtocols SelectProtocol()
var isMultiplexTransport = _context is HttpMultiplexedConnectionContext;
var http1Enabled = _context.Protocols.HasFlag(HttpProtocols.Http1);
var http2Enabled = _context.Protocols.HasFlag(HttpProtocols.Http2);
#pragma warning disable CA2252 // Preview Features
var http3Enabled = _context.Protocols.HasFlag(HttpProtocols.Http3);
#pragma warning restore CA2252

string? error = null;

Expand All @@ -218,7 +222,9 @@ private HttpProtocols SelectProtocol()
{
if (http3Enabled)
{
#pragma warning disable CA2252 // Preview Features
return HttpProtocols.Http3;
#pragma warning restore CA2252
}

error = $"Protocols {_context.Protocols} not supported on multiplexed transport.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ private static bool IsHex(char ch)
public static AltSvcHeader? GetEndpointAltSvc(System.Net.IPEndPoint endpoint, HttpProtocols protocols)
{
var hasHttp1OrHttp2 = protocols.HasFlag(HttpProtocols.Http1) || protocols.HasFlag(HttpProtocols.Http2);
#pragma warning disable CA2252 // Preview Features
var hasHttp3 = protocols.HasFlag(HttpProtocols.Http3);
#pragma warning restore CA2252

if (hasHttp1OrHttp2 && hasHttp3)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Servers/Kestrel/Core/src/Internal/KestrelServerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ async Task OnBind(ListenOptions options, CancellationToken onBindCancellationTok
{
var hasHttp1 = options.Protocols.HasFlag(HttpProtocols.Http1);
var hasHttp2 = options.Protocols.HasFlag(HttpProtocols.Http2);
#pragma warning disable CA2252 // Preview Features
var hasHttp3 = options.Protocols.HasFlag(HttpProtocols.Http3);
#pragma warning restore CA2252
var hasTls = options.IsTls;

// Filter out invalid combinations.
Expand Down
4 changes: 4 additions & 0 deletions src/Servers/Kestrel/Core/src/ListenOptionsHttpsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,12 @@ public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOpt
/// <returns>The <see cref="ListenOptions"/>.</returns>
public static ListenOptions UseHttps(this ListenOptions listenOptions, ServerOptionsSelectionCallback serverOptionsSelectionCallback, object state, TimeSpan handshakeTimeout)
{
#pragma warning disable CA2252 // Preview Features
if (listenOptions.Protocols.HasFlag(HttpProtocols.Http3))
{
throw new NotSupportedException($"{nameof(UseHttps)} with {nameof(ServerOptionsSelectionCallback)} is not supported with HTTP/3.");
}
#pragma warning restore CA2252
return listenOptions.UseHttps(new TlsHandshakeCallbackOptions()
{
OnConnection = context => serverOptionsSelectionCallback(context.SslStream, context.ClientHelloInfo, context.State, context.CancellationToken),
Expand Down Expand Up @@ -287,10 +289,12 @@ public static ListenOptions UseHttps(this ListenOptions listenOptions, TlsHandsh
throw new ArgumentException($"{nameof(TlsHandshakeCallbackOptions.OnConnection)} must not be null.");
}

#pragma warning disable CA2252 // Preview Features
if (listenOptions.Protocols.HasFlag(HttpProtocols.Http3))
{
throw new NotSupportedException($"{nameof(UseHttps)} with {nameof(TlsHandshakeCallbackOptions)} is not supported with HTTP/3.");
}
#pragma warning restore CA2252

var loggerFactory = listenOptions.KestrelServerOptions?.ApplicationServices.GetRequiredService<ILoggerFactory>() ?? NullLoggerFactory.Instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TestGroupName>Kestrel.Core.Tests</TestGroupName>
<DefineConstants>$(DefineConstants);KESTREL</DefineConstants>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public static class WebHostBuilderKestrelExtensions
/// </returns>
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder)
{
#pragma warning disable CA2252 // Preview Features
hostBuilder.UseQuic();
#pragma warning restore CA2252
return hostBuilder.ConfigureServices(services =>
{
// Don't override an already-configured transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!-- https://github.com/dotnet/aspnetcore/issues/22114 -->
<SkipHelixArm>true</SkipHelixArm>
<SkipHelixAlpine>true</SkipHelixAlpine>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;kestrel</PackageTags>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>CA1416;CS1591;CS0436;$(NoWarn)</NoWarn><!-- Conflicts between internal and public Quic APIs; Platform support warnings. -->
<NoWarn>CA1416;CS1591;CS0436;$(NoWarn)</NoWarn> <!-- Conflicts between internal and public Quic APIs; Platform support warnings. -->
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<EnablePreviewFeatures>True</EnablePreviewFeatures> <!-- System.Net.Quic is still in preview -->
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ServerGarbageCollection>true</ServerGarbageCollection>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ServerGarbageCollection>true</ServerGarbageCollection>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TieredCompilation>false</TieredCompilation>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TestGroupName>InMemory.FunctionalTests</TestGroupName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);IS_FUNCTIONAL_TESTS</DefineConstants>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<SignAssembly>false</SignAssembly>
<SkipHelixArm>true</SkipHelixArm>
<SkipHelixAlpine>true</SkipHelixAlpine>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TestGroupName>Libuv.BindTests</TestGroupName>
<!-- https://github.com/dotnet/aspnetcore/issues/22114 -->
<SkipHelixQueues>Windows.10.Arm64;Windows.10.Arm64.Open;Windows.10.Arm64v8;Windows.10.Arm64v8.Open</SkipHelixQueues>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<TestGroupName>Libuv.FunctionalTests</TestGroupName>
<!-- https://github.com/dotnet/aspnetcore/issues/22114 -->
<SkipHelixQueues>Windows.10.Arm64;Windows.10.Arm64.Open;Windows.10.Arm64v8;Windows.10.Arm64v8.Open</SkipHelixQueues>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TestGroupName>Sockets.BindTests</TestGroupName>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<DefineConstants>$(DefineConstants);SOCKETS</DefineConstants>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TestGroupName>Sockets.FunctionalTests</TestGroupName>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down