Skip to content

Conversation

@pavelsavara
Copy link
Member

  • stop calling blocking Task.WaitAll on browser - it throws PNSE
  • make the method async, rename it and fix all call sites

@pavelsavara pavelsavara added this to the 11.0.0 milestone Jan 18, 2026
@pavelsavara pavelsavara self-assigned this Jan 18, 2026
@pavelsavara pavelsavara added area-System.Net.Http os-browser Browser variant of arch-wasm labels Jan 18, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@pavelsavara pavelsavara marked this pull request as ready for review January 19, 2026 19:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request converts synchronous socket operations to asynchronous ones to avoid calling blocking Task.WaitAll on browser platforms where it throws PlatformNotSupportedException. The changes rename CloseWebSocket() to CloseWebSocketAsync() and make the wrapper methods CloseAsync() and ShutdownAsync() async, then update all call sites throughout the test codebase.

Changes:

  • Made SocketWrapper.CloseAsync(), SocketWrapper.ShutdownAsync(), and SocketWrapper.CloseWebSocketAsync() async to avoid blocking calls
  • Converted Http2LoopbackConnection.ShutdownSend() to ShutdownSendAsync()
  • Updated all call sites across test files to await the newly async methods

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
GenericLoopbackServer.cs Converted CloseWebSocket() to async CloseWebSocketAsync(), made Close() and Shutdown() async, removed blocking Task.WaitAll call
Http2LoopbackConnection.cs Converted ShutdownSend() to async ShutdownSendAsync() with proper null checking
LoopbackServer.cs Updated calls to closableWrapper.CloseAsync() and _socket.ShutdownAsync() to be awaited
SendReceiveTest.Loopback.cs Updated socket shutdown/close calls to async versions
WebSocketHandshakeHelper.cs Updated socket shutdown call to async version
SocketsHttpHandlerTest.cs Updated socket/listen socket close and shutdown calls to async versions
MetricsTest.cs Updated socket shutdown call to async version
HttpClientMiniStressTest.cs Updated socket shutdown call to async version
HttpClientHandlerTest.ResponseDrain.cs Updated listen socket close call to async version
HttpClientHandlerTest.RequestRetry.cs Updated listen socket close call to async version
HttpClientHandlerTest.Http2.cs Updated connection shutdown calls to async versions
HttpClientHandlerTest.AutoRedirect.cs Updated socket shutdown calls to async versions

pavelsavara and others added 3 commits January 20, 2026 20:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…er.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@CarnaViire CarnaViire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pavelsavara
Copy link
Member Author

looks ok :)

Log

[07:56:30] info: Finished:    System.Net.Http.Functional.Tests.dll
[07:56:30] info: Stored /root/helix/work/workitem/uploads/xharness-output/testResults.xml results 433760 bytes
[07:56:30] info: Finished uploading 433760 bytes of RESULTXML
[07:56:30] info: Xml file was written to the provided writer.
[07:56:30] info: 
[07:56:30] info: === TEST EXECUTION SUMMARY ===
[07:56:30] info: Tests run: 901 Passed: 781 Inconclusive: 0 Failed: 0 Ignored: 0 Skipped: 120
[07:56:30] info: 
[07:56:30] info: test-main.js exiting WasmTestRunner.dll System.Net.Http.Functional.Tests.dll after 0.64215 minutes with result 0 and linear memory 144703488 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net.Http os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants