Description
This breaking change introduces default support for streaming HTTP responses in browser HTTP clients, which previously required opt-in. This enhancement leverages the capabilities of modern evergreen browsers to improve memory consumption and responsiveness, particularly for large data requests and scenarios like streaming AI chat responses. However, developers should be aware that the response.Content.ReadAsStreamAsync() method will now return a BrowserHttpReadStream instead of a MemoryStream, which does not support synchronous operations. This change may impact existing code that relies on synchronous stream operations.
See dotnet/runtime#111680 for details
Version
.NET 10 Preview 3
Previous behavior
In the Browser/Wasm/Blazor, previously the C# HTTP client buffered the whole response and the HttpContent contained full MemoryStream by default. Unless you opted in via WebAssemblyEnableStreamingResponse HttpRequestOption which enabled the streaming response, typical on other operating systems.
New behavior
The WebAssemblyEnableStreamingResponse is now opt-out instead of opt-in. The HttpContent is not MemoryStream by default.
Type of breaking change
Reason for change
To aid use-cases around streaming GetFromJsonAsAsyncEnumerable which work by default on other OSes.
Recommended action
If you need to disable it globally, you can use
set env variable DOTNET_WASM_ENABLE_STREAMING_RESPONSE
We plan to make the <WasmEnableStreamingResponse>false</WasmEnableStreamingResponse> in your project file for in future previews of Net 10. See dotnet/runtime#97449
To disable it for individual request, you can use existing
request.Options.Set(new HttpRequestOptionsKey<bool>("WebAssemblyEnableStreamingResponse"), false);
or request.SetBrowserResponseStreamingEnabled(false) extension in Blazor project
Feature area
Networking
Affected APIs
No response
Associated WorkItem - 418815
Description
This breaking change introduces default support for streaming HTTP responses in browser HTTP clients, which previously required opt-in. This enhancement leverages the capabilities of modern evergreen browsers to improve memory consumption and responsiveness, particularly for large data requests and scenarios like streaming AI chat responses. However, developers should be aware that the
response.Content.ReadAsStreamAsync()method will now return aBrowserHttpReadStreaminstead of aMemoryStream, which does not support synchronous operations. This change may impact existing code that relies on synchronous stream operations.See dotnet/runtime#111680 for details
Version
.NET 10 Preview 3
Previous behavior
In the Browser/Wasm/Blazor, previously the C# HTTP client buffered the whole response and the
HttpContentcontained fullMemoryStreamby default. Unless you opted in viaWebAssemblyEnableStreamingResponseHttpRequestOption which enabled the streaming response, typical on other operating systems.New behavior
The
WebAssemblyEnableStreamingResponseis now opt-out instead of opt-in. TheHttpContentis notMemoryStreamby default.Type of breaking change
Reason for change
To aid use-cases around streaming
GetFromJsonAsAsyncEnumerablewhich work by default on other OSes.Recommended action
If you need to disable it globally, you can use
set env variable
DOTNET_WASM_ENABLE_STREAMING_RESPONSEWe plan to make the
<WasmEnableStreamingResponse>false</WasmEnableStreamingResponse>in your project file for in future previews of Net 10. See dotnet/runtime#97449To disable it for individual request, you can use existing
request.Options.Set(new HttpRequestOptionsKey<bool>("WebAssemblyEnableStreamingResponse"), false);or
request.SetBrowserResponseStreamingEnabled(false)extension in Blazor projectFeature area
Networking
Affected APIs
No response
Associated WorkItem - 418815