diff --git a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs index c4de27f4ee9f6..8583186ad64fd 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs +++ b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net.Http; using System.Text.Json; +using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -139,7 +140,9 @@ async Task RewriteArray(HttpContext context) Dictionary[] tabs = await ProxyGetJsonAsync[]>(GetEndpoint(context)); Dictionary[] alteredTabs = tabs.Select(t => mapFunc(t, context, devToolsHost)).ToArray(); context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(alteredTabs)); + byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(alteredTabs)); + context.Response.ContentLength = bytes.Length; + await context.Response.Body.WriteAsync(bytes); } async Task ConnectProxy(HttpContext context)