Skip to content

Commit cdabbaa

Browse files
committed
Merged PR 21913: Merge from public release/6.0
# {PR title} Summary of the changes (Less than 80 chars) ## Description {Detail} Fixes #{bug number} (in this specific format) ## Customer Impact {Justification} ## Regression? - [ ] Yes - [ ] No [If yes, specify the version the behavior has regressed from] ## Risk - [ ] High - [ ] Medium - [ ] Low [Justify the selection above] ## Verification - [ ] Manual (required) - [ ] Automated ## Packaging changes reviewed? - [ ] Yes - [ ] No - [ ] N/A ---- ## When servicing release/2.1 - [ ] Make necessary changes in eng/PatchConfig.props
2 parents 578ba6d + 0498f89 commit cdabbaa

File tree

14 files changed

+55
-13
lines changed

14 files changed

+55
-13
lines changed

src/Components/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The following contains a description of each sub-directory in the `Components` d
2626
- `Server`: Contains the implementation for WASM-specific extension methods and the launch logic for the debugging proxy
2727
- `WebAssembly`: Contains WebAssembly-specific implementations of the renderer, HostBuilder, etc.
2828
- `WebAssembly.Authentication`: Contains the WASM-specific implementations
29+
- `WebView`: Contains the source files to support [Blazor Hybrid](https://github.com/dotnet/maui/tree/main/src/BlazorWebView) within [`dotnet/maui`](https://github.com/dotnet/maui). Changes in this project can be tested with `dotnet/maui` following [this guide](https://github.com/dotnet/maui/wiki/Blazor-Desktop#aspnet-core).
2930

3031
## Development Setup
3132

src/Components/WebView/WebView/src/IpcSender.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Diagnostics.CodeAnalysis;
6+
using System.Runtime.ExceptionServices;
67
using System.Threading.Tasks;
78
using Microsoft.AspNetCore.Components.RenderTree;
89
using Microsoft.JSInterop;
@@ -62,8 +63,12 @@ public void SendByteArray(int id, byte[] data)
6263

6364
public void NotifyUnhandledException(Exception exception)
6465
{
66+
// Send the serialized exception to the WebView for display
6567
var message = IpcCommon.Serialize(IpcCommon.OutgoingMessageType.NotifyUnhandledException, exception.Message, exception.StackTrace);
6668
_dispatcher.InvokeAsync(() => _messageDispatcher(message));
69+
70+
// Also rethrow so the AppDomain's UnhandledException handler gets notified
71+
_dispatcher.InvokeAsync(() => ExceptionDispatchInfo.Capture(exception).Throw());
6772
}
6873

6974
private void DispatchMessageWithErrorHandling(string message)

src/Components/WebView/WebView/src/Services/WebViewRenderer.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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.Runtime.ExceptionServices;
54
using System.Text.Json;
65
using Microsoft.AspNetCore.Components.RenderTree;
76
using Microsoft.AspNetCore.Components.Web;
@@ -38,9 +37,6 @@ protected override void HandleException(Exception exception)
3837
{
3938
// Notify the JS code so it can show the in-app UI
4039
_ipcSender.NotifyUnhandledException(exception);
41-
42-
// Also rethrow so the AppDomain's UnhandledException handler gets notified
43-
ExceptionDispatchInfo.Capture(exception).Throw();
4440
}
4541

4642
protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)

src/Servers/HttpSys/src/Microsoft.AspNetCore.Server.HttpSys.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<Compile Include="$(SharedSourceRoot)HttpSys\**\*.cs" />
1919
<Compile Include="$(SharedSourceRoot)Buffers.MemoryPool\*.cs" LinkBase="MemoryPool" />
2020
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\StringUtilities.cs" LinkBase="ServerInfrastructure\StringUtilities.cs" />
21+
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\HttpCharacters.cs" LinkBase="ServerInfrastructure\HttpCharacters.cs" />
2122
<Compile Include="$(SharedSourceRoot)TaskToApm.cs" />
2223
</ItemGroup>
2324

src/Servers/HttpSys/test/FunctionalTests/ResponseHeaderTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ public async Task ResponseHeaders_ServerSendsCustomHeaders_Success()
113113
}
114114
}
115115

116+
[ConditionalFact]
117+
public async Task ResponseHeaders_ServerSendsNonAsciiHeaders_Success()
118+
{
119+
string address;
120+
using (Utilities.CreateHttpServer(out address, httpContext =>
121+
{
122+
var responseInfo = httpContext.Features.Get<IHttpResponseFeature>();
123+
var responseHeaders = responseInfo.Headers;
124+
responseHeaders["Custom-Header1"] = new string[] { "Dašta" };
125+
return Task.FromResult(0);
126+
}))
127+
{
128+
var socketsHttpHandler = new SocketsHttpHandler() { ResponseHeaderEncodingSelector = (_, _) => Encoding.UTF8 };
129+
var httpClient = new HttpClient(socketsHttpHandler);
130+
var response = await httpClient.GetAsync(address);
131+
response.EnsureSuccessStatusCode();
132+
Assert.True(response.Headers.TryGetValues("Custom-Header1", out var header));
133+
Assert.Equal("Dašta", header.Single());
134+
}
135+
}
136+
116137
[ConditionalFact]
117138
public async Task ResponseHeaders_ServerSendsConnectionClose_Closed()
118139
{

src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.IO.Pipelines;
99
using System.Threading.Tasks;
1010
using Microsoft.AspNetCore.Connections;
11+
using Microsoft.AspNetCore.Http;
1112
using Microsoft.AspNetCore.Http.Features;
1213
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
1314

src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.Runtime.InteropServices;
1111
using System.Text;
1212
using Microsoft.AspNetCore.Http;
13-
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
1413
using Microsoft.Extensions.Primitives;
1514
using Microsoft.Net.Http.Headers;
1615

src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Diagnostics;
77
using System.Runtime.CompilerServices;
88
using System.Runtime.InteropServices;
9+
using Microsoft.AspNetCore.Http;
910
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
1011

1112
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http

src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
1717
using Microsoft.Extensions.Primitives;
1818
using Microsoft.Net.Http.Headers;
19+
using HttpCharacters = Microsoft.AspNetCore.Http.HttpCharacters;
1920
using HttpMethods = Microsoft.AspNetCore.Http.HttpMethods;
2021

2122
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Extensions.Logging;
1616
using Microsoft.Extensions.Primitives;
1717
using Microsoft.Net.Http.Headers;
18+
using HttpCharacters = Microsoft.AspNetCore.Http.HttpCharacters;
1819

1920
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3
2021
{

0 commit comments

Comments
 (0)