From c8e4da252edd3637acb7c08d61f8bae9aba213b5 Mon Sep 17 00:00:00 2001 From: Roman Konecny Date: Tue, 15 Sep 2026 10:09:53 -0700 Subject: [PATCH] test(iis): scope upgrade MaxRequestBodySize assert to in-process hosting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - in-process must clear the limit on upgrade because its read loop enforces it - out-of-process runs on Kestrel, which never enforces it once upgraded - unblocks the three WebSocketsOutOfProcessTests failures 🧪 - Generated by Copilot (cherry picked from commit befb2e9de23fee6eb5f463fc383494f525a100da) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../testassets/InProcessWebSite/Startup.WebSockets.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs index d0750ef81fd4..fda6e51107c4 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs +++ b/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs @@ -120,7 +120,13 @@ private static async Task Upgrade(HttpContext context) // Upgrade the connection Stream opaqueTransport = await upgradeFeature.UpgradeAsync(); - Assert.Null(context.Features.Get().MaxRequestBodySize); + + // In-process reads upgraded data through the same loop that enforces MaxRequestBodySize, so it + // must clear the limit. Out-of-process runs on Kestrel, which never enforces it once upgraded. + if (context.Features.Get() is not null) + { + Assert.Null(context.Features.Get().MaxRequestBodySize); + } // Get the WebSocket object var ws = WebSocket.CreateFromStream(opaqueTransport, isServer: true, subProtocol: null, keepAliveInterval: TimeSpan.FromMinutes(2));