Skip to content

[browser] no sockets#124347

Open
pavelsavara wants to merge 1 commit intodotnet:mainfrom
pavelsavara:browser_no_sockets2
Open

[browser] no sockets#124347
pavelsavara wants to merge 1 commit intodotnet:mainfrom
pavelsavara:browser_no_sockets2

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Feb 12, 2026

Continuation from #123962 (comment)
Contributes to #122506

Browser variant of

  • System.Net.Sockets now throw PNSE for all members.
  • SocketAddressPal.Browser.cs doesn't talk to posix and it's shallow similar to SocketAddressPal.Windows.cs

@pavelsavara pavelsavara added this to the 11.0.0 milestone Feb 12, 2026
@pavelsavara pavelsavara self-assigned this Feb 12, 2026
Copilot AI review requested due to automatic review settings February 12, 2026 15:32
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-System.Net.Sockets os-browser Browser variant of arch-wasm labels Feb 12, 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.

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 PR advances the browser-WASM “no sockets” effort by making networking/socket-related components consistently unavailable on the browser target, aligning with the broader PAL cleanup work.

Changes:

  • Add browser-specific System.Native stubs for networking, interface addresses, and network statistics.
  • Switch browser builds away from syscall-trimming JS hacks and toward native/CMake-based stubbing/linking behavior.
  • Add a -browser TFM for System.Net.Sockets that builds as a PlatformNotSupported assembly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/native/libs/System.Native/pal_networkstatistics_wasm.c Adds WASM/browser stub implementations for network statistics APIs.
src/native/libs/System.Native/pal_networking_browser.c Adds browser stub implementations for System.Native networking/socket entrypoints.
src/native/libs/System.Native/pal_interfaceaddresses_browser.c Adds browser stub implementations for interface/gateway enumeration.
src/native/libs/System.Native/CMakeLists.txt Selects browser-specific PAL sources for System.Native.
src/native/eventpipe/ds-ipc-pal-websocket.c Adds missing runtime helpers for standalone PAL websocket IPC path.
src/native/corehost/browserhost/libBrowserHost.footer.js Removes syscall override hooks previously used to “trim” sockets.
src/mono/mono/profiler/log.c Gates socket header inclusion on configure-time header availability.
src/mono/mono/profiler/helper.c Gates socket-related includes on configure-time header availability.
src/mono/mono/profiler/aot.c Gates socket header inclusion on configure-time header availability.
src/mono/mono/mini/cfgdump.c Gates socket header inclusion on configure-time header availability.
src/libraries/System.Net.Sockets/src/System.Net.Sockets.csproj Adds -browser TFM and marks it as PlatformNotSupported.
eng/native/tryrun.browser.cmake Disables HAVE_SYS_SOCKET_H for browser to avoid emscripten socket emulation.
eng/native/configureplatform.cmake Adds browser CoreCLR link options (-nostdlib + explicit libs).

Copilot AI review requested due to automatic review settings February 12, 2026 15:44
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings February 13, 2026 15:56
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

@pavelsavara pavelsavara marked this pull request as ready for review February 13, 2026 19:00
@jkotas jkotas requested a review from a team February 13, 2026 20:00
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM

It would be nice if folks with more detailed understanding of networking and/or wasm signoff as well.

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

Labels

arch-wasm WebAssembly architecture area-System.Net.Sockets os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants