Skip to content

Commit e00c244

Browse files
BrennanConroydougbupranavkmcaptainsafiahalter73
authored
[automated] Merge branch 'release/6.0-rc2' => 'release/6.0' (#36901)
* Update WiX to signed build (#36865) - #12078 * Always download blazor-hotreload.js from app root (#36897) The middleware that we inject always listens to the root of the app. While this might not play very nicely if the app is running off a virtual path, listening to the root is what we do with the aspnet-browser-refresh.js script and we've had no issue reports with it thus far. Fixes #35555 * Improve Results.Problem and Results.ValidationProblem APIs (#36856) * [release/6.0-rc2] Update sdk to 6.0.100-rc.2.21470.55 (#36783) * Update sdk to 6.0.100-rc.2.21470.55 Co-authored-by: Will Godbe <[email protected]> Co-authored-by: Doug Bunting <[email protected]> Co-authored-by: Pranav K <[email protected]> Co-authored-by: Safia Abdalla <[email protected]> Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: Will Godbe <[email protected]> Co-authored-by: Brennan <[email protected]>
2 parents 3447aa9 + 8ab7d80 commit e00c244

24 files changed

+102
-18
lines changed

eng/targets/Wix.Common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<SchemaVersion>2.0</SchemaVersion>
66
<ProductVersion>3.14</ProductVersion>
7-
<WixVersion>3.14.0-dotnet</WixVersion>
7+
<WixVersion>1.0.0-v3.14.0.4118</WixVersion>
88
</PropertyGroup>
99

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

2222
<ItemGroup>
23-
<PackageReference Include="Wix" Version="$(WixVersion)" />
23+
<PackageReference Include="Microsoft.Signed.Wix" Version="$(WixVersion)" />
2424
</ItemGroup>
2525

2626
<PropertyGroup>

eng/tools/RepoTasks/RepoTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</ItemGroup>
2727

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

3232
<Reference Include="Microsoft.Build" />

src/Http/Http.Results/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ static Microsoft.AspNetCore.Http.Results.LocalRedirect(string! localUrl, bool pe
2020
static Microsoft.AspNetCore.Http.Results.NoContent() -> Microsoft.AspNetCore.Http.IResult!
2121
static Microsoft.AspNetCore.Http.Results.NotFound(object? value = null) -> Microsoft.AspNetCore.Http.IResult!
2222
static Microsoft.AspNetCore.Http.Results.Ok(object? value = null) -> Microsoft.AspNetCore.Http.IResult!
23-
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!
23+
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!
24+
static Microsoft.AspNetCore.Http.Results.Problem(Microsoft.AspNetCore.Mvc.ProblemDetails! problemDetails) -> Microsoft.AspNetCore.Http.IResult!
2425
static Microsoft.AspNetCore.Http.Results.Redirect(string! url, bool permanent = false, bool preserveMethod = false) -> Microsoft.AspNetCore.Http.IResult!
2526
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!
2627
static Microsoft.AspNetCore.Http.Results.SignIn(System.Security.Claims.ClaimsPrincipal! principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties? properties = null, string? authenticationScheme = null) -> Microsoft.AspNetCore.Http.IResult!
@@ -30,6 +31,6 @@ static Microsoft.AspNetCore.Http.Results.Stream(System.IO.Stream! stream, string
3031
static Microsoft.AspNetCore.Http.Results.Text(string! content, string? contentType = null, System.Text.Encoding? contentEncoding = null) -> Microsoft.AspNetCore.Http.IResult!
3132
static Microsoft.AspNetCore.Http.Results.Unauthorized() -> Microsoft.AspNetCore.Http.IResult!
3233
static Microsoft.AspNetCore.Http.Results.UnprocessableEntity(object? error = null) -> Microsoft.AspNetCore.Http.IResult!
33-
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!
34+
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!
3435
static Microsoft.AspNetCore.Http.Results.Extensions.get -> Microsoft.AspNetCore.Http.IResultExtensions!
35-
Microsoft.AspNetCore.Http.IResultExtensions
36+
Microsoft.AspNetCore.Http.IResultExtensions

src/Http/Http.Results/src/Results.cs

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,23 +471,46 @@ public static IResult UnprocessableEntity(object? error = null)
471471
/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param>
472472
/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param>
473473
/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param>
474+
/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
474475
/// <returns>The created <see cref="IResult"/> for the response.</returns>
475476
public static IResult Problem(
476477
string? detail = null,
477478
string? instance = null,
478479
int? statusCode = null,
479480
string? title = null,
480-
string? type = null)
481+
string? type = null,
482+
IDictionary<string, object?>? extensions = null)
481483
{
482484
var problemDetails = new ProblemDetails
483485
{
484486
Detail = detail,
485487
Instance = instance,
486488
Status = statusCode,
487489
Title = title,
488-
Type = type
490+
Type = type,
489491
};
490492

493+
if (extensions is not null)
494+
{
495+
foreach (var extension in extensions)
496+
{
497+
problemDetails.Extensions.Add(extension);
498+
}
499+
}
500+
501+
return new ObjectResult(problemDetails)
502+
{
503+
ContentType = "application/problem+json",
504+
};
505+
}
506+
507+
/// <summary>
508+
/// Produces a <see cref="ProblemDetails"/> response.
509+
/// </summary>
510+
/// <param name="problemDetails">The <see cref="ProblemDetails"/> object to produce a response from.</param>
511+
/// <returns>The created <see cref="IResult"/> for the response.</returns>
512+
public static IResult Problem(ProblemDetails problemDetails)
513+
{
491514
return new ObjectResult(problemDetails)
492515
{
493516
ContentType = "application/problem+json",
@@ -502,25 +525,36 @@ public static IResult Problem(
502525
/// <param name="detail">The value for <see cref="ProblemDetails.Detail" />.</param>
503526
/// <param name="instance">The value for <see cref="ProblemDetails.Instance" />.</param>
504527
/// <param name="statusCode">The status code.</param>
505-
/// <param name="title">The value for <see cref="ProblemDetails.Title" />.</param>
528+
/// <param name="title">The value for <see cref="ProblemDetails.Title" />. Defaults to "One or more validation errors occurred."</param>
506529
/// <param name="type">The value for <see cref="ProblemDetails.Type" />.</param>
530+
/// <param name="extensions">The value for <see cref="ProblemDetails.Extensions" />.</param>
507531
/// <returns>The created <see cref="IResult"/> for the response.</returns>
508532
public static IResult ValidationProblem(
509533
IDictionary<string, string[]> errors,
510534
string? detail = null,
511535
string? instance = null,
512536
int? statusCode = null,
513537
string? title = null,
514-
string? type = null)
538+
string? type = null,
539+
IDictionary<string, object?>? extensions = null)
515540
{
516541
var problemDetails = new HttpValidationProblemDetails(errors)
517542
{
518543
Detail = detail,
519544
Instance = instance,
520-
Title = title,
521545
Type = type,
522546
Status = statusCode,
523547
};
548+
549+
problemDetails.Title = title ?? problemDetails.Title;
550+
551+
if (extensions is not null)
552+
{
553+
foreach (var extension in extensions)
554+
{
555+
problemDetails.Extensions.Add(extension);
556+
}
557+
}
524558

525559
return new ObjectResult(problemDetails)
526560
{

src/Http/samples/MinimalSample/MinimalSample.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<Reference Include="Microsoft.AspNetCore" />
99
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
1010
<Reference Include="Microsoft.AspNetCore.Hosting" />
11+
<Reference Include="Microsoft.AspNetCore.Http" />
12+
<Reference Include="Microsoft.AspNetCore.Http.Results" />
1113
<!-- Mvc.Core is referenced only for its attributes -->
1214
<Reference Include="Microsoft.AspNetCore.Mvc.Core" />
1315
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
5-
using Microsoft.AspNetCore.Builder;
6-
using Microsoft.Extensions.Hosting;
4+
using Microsoft.AspNetCore.Mvc;
75

86
var app = WebApplication.Create(args);
97

@@ -13,12 +11,29 @@
1311
}
1412

1513
string Plaintext() => "Hello, World!";
16-
app.MapGet("/plaintext", (Func<string>)Plaintext);
14+
app.MapGet("/plaintext", Plaintext);
15+
1716

1817
object Json() => new { message = "Hello, World!" };
19-
app.MapGet("/json", (Func<object>)Json);
18+
app.MapGet("/json", Json);
2019

2120
string SayHello(string name) => $"Hello, {name}!";
22-
app.MapGet("/hello/{name}", (Func<string, string>)SayHello);
21+
app.MapGet("/hello/{name}", SayHello);
22+
23+
var extensions = new Dictionary<string, object>() { { "traceId", "traceId123" } };
24+
25+
app.MapGet("/problem", () =>
26+
Results.Problem(statusCode: 500, extensions: extensions));
27+
28+
app.MapGet("/problem-object", () =>
29+
Results.Problem(new ProblemDetails() { Status = 500, Extensions = { { "traceId", "traceId123"} } }));
30+
31+
var errors = new Dictionary<string, string[]>();
32+
33+
app.MapGet("/validation-problem", () =>
34+
Results.ValidationProblem(errors, statusCode: 400, extensions: extensions));
35+
36+
app.MapGet("/validation-problem-object", () =>
37+
Results.Problem(new HttpValidationProblemDetails(errors) { Status = 400, Extensions = { { "traceId", "traceId123"}}}));
2338

2439
app.Run();

src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,9 @@ private Http3StreamContext CreateHttpStreamContext(ConnectionContext streamConte
457457
{
458458
var httpConnectionContext = new Http3StreamContext(
459459
_multiplexedContext.ConnectionId,
460+
#pragma warning disable CA2252 // Preview Features
460461
HttpProtocols.Http3,
462+
#pragma warning restore CA2252
461463
_context.AltSvcHeader,
462464
_multiplexedContext,
463465
_context.ServiceContext,
@@ -537,7 +539,9 @@ private async ValueTask<Http3ControlStream> CreateNewUnidirectionalStreamAsync<T
537539
var streamContext = await _multiplexedContext.ConnectAsync(features);
538540
var httpConnectionContext = new Http3StreamContext(
539541
_multiplexedContext.ConnectionId,
542+
#pragma warning disable CA2252 // Preview Features
540543
HttpProtocols.Http3,
544+
#pragma warning restore CA2252
541545
_context.AltSvcHeader,
542546
_multiplexedContext,
543547
_context.ServiceContext,

src/Servers/Kestrel/Core/src/Internal/HttpConnection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> http
7070
requestProcessor = new Http2Connection((HttpConnectionContext)_context);
7171
_protocolSelectionState = ProtocolSelectionState.Selected;
7272
break;
73+
#pragma warning disable CA2252 // Preview Features
7374
case HttpProtocols.Http3:
7475
requestProcessor = new Http3Connection((HttpMultiplexedConnectionContext)_context);
76+
#pragma warning restore CA2252
7577
_protocolSelectionState = ProtocolSelectionState.Selected;
7678
break;
7779
case HttpProtocols.None:
@@ -205,7 +207,9 @@ private HttpProtocols SelectProtocol()
205207
var isMultiplexTransport = _context is HttpMultiplexedConnectionContext;
206208
var http1Enabled = _context.Protocols.HasFlag(HttpProtocols.Http1);
207209
var http2Enabled = _context.Protocols.HasFlag(HttpProtocols.Http2);
210+
#pragma warning disable CA2252 // Preview Features
208211
var http3Enabled = _context.Protocols.HasFlag(HttpProtocols.Http3);
212+
#pragma warning restore CA2252
209213

210214
string? error = null;
211215

@@ -218,7 +222,9 @@ private HttpProtocols SelectProtocol()
218222
{
219223
if (http3Enabled)
220224
{
225+
#pragma warning disable CA2252 // Preview Features
221226
return HttpProtocols.Http3;
227+
#pragma warning restore CA2252
222228
}
223229

224230
error = $"Protocols {_context.Protocols} not supported on multiplexed transport.";

src/Servers/Kestrel/Core/src/Internal/Infrastructure/HttpUtilities.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,9 @@ private static bool IsHex(char ch)
536536
public static AltSvcHeader? GetEndpointAltSvc(System.Net.IPEndPoint endpoint, HttpProtocols protocols)
537537
{
538538
var hasHttp1OrHttp2 = protocols.HasFlag(HttpProtocols.Http1) || protocols.HasFlag(HttpProtocols.Http2);
539+
#pragma warning disable CA2252 // Preview Features
539540
var hasHttp3 = protocols.HasFlag(HttpProtocols.Http3);
541+
#pragma warning restore CA2252
540542

541543
if (hasHttp1OrHttp2 && hasHttp3)
542544
{

src/Servers/Kestrel/Core/src/Internal/KestrelServerImpl.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ async Task OnBind(ListenOptions options, CancellationToken onBindCancellationTok
168168
{
169169
var hasHttp1 = options.Protocols.HasFlag(HttpProtocols.Http1);
170170
var hasHttp2 = options.Protocols.HasFlag(HttpProtocols.Http2);
171+
#pragma warning disable CA2252 // Preview Features
171172
var hasHttp3 = options.Protocols.HasFlag(HttpProtocols.Http3);
173+
#pragma warning restore CA2252
172174
var hasTls = options.IsTls;
173175

174176
// Filter out invalid combinations.

0 commit comments

Comments
 (0)