[release/8.0] Disable buffering of Blazor streaming responses #53930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #53929 to release/8.0
/cc @halter73
Disable buffering of Blazor streaming responses
Description
This change disables response buffering and compression (edit: if compression would cause buffering) for streaming Blazor responses in the same way SignalR does for streaming SSE responses. It checks the state of the QuiescenceTask before writing the initial render to the response body to avoid unnecessarily disabling buffering for non-streaming responses.
Fixes #52323
Customer Impact
Instead of seeing UI update immediately as new content becomes available which is the point of streaming rendering, the streaming component is only rendered after all the content arrives completely. This may be never depending on the design of the application.
This affects customers hosting Blazor apps on servers that buffer responses. This includes App Service and IIS Express in their default configurations. You can work around this by configuring the server to disable compression and buffering as described in the customer reported issue at #52323, but it's not discoverable. Nonetheless at least 5 customers have found this issue already.
Regression?
Risk
This change only affects streaming rendering which is new in .NET 8, and it uses a pattern already used by SignalR for SSE responses to disable buffering.
Verification
Packaging changes reviewed?