Skip to content

De-duplicate PreAllocatedOverlapped non-Windows stubs; remove stale ILLink workaround#125507

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/remove-duplicate-overlapped-implementations
Draft

De-duplicate PreAllocatedOverlapped non-Windows stubs; remove stale ILLink workaround#125507
Copilot wants to merge 2 commits intomainfrom
copilot/remove-duplicate-overlapped-implementations

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

PreAllocatedOverlapped had two separate implementations for non-Windows platforms: a full portable implementation (Unix.cs) for Unix and Browser with managed threads, and a no-op stub (Browser.cs) for Browser/Wasi without managed threads — despite overlapped I/O being unsupported (ThreadPoolBoundHandle.BindHandle always throws PlatformNotSupportedException) on all non-Windows targets.

Changes

  • Delete PreAllocatedOverlapped.Browser.cs — the no-op stub is replaced by the existing portable implementation.
  • Extend PreAllocatedOverlapped.Unix.cs + Portable.cs to all non-Windows platforms — moved outside the FeaturePortableThreadPool ItemGroup into a new TargetsWindows != true group, so they compile for Browser/Wasi regardless of FeaturePortableThreadPool.
  • Keep Portable.cs in the FeaturePortableThreadPool group for Windows — required for the portable thread pool code path on Windows.
  • Add ThreadPoolBoundHandleOverlapped.cs to the Browser/Wasi-without-managed-threads groupPortable.cs depends on it; previously it was only compiled under FeaturePortableThreadPool.
  • Remove stale ThreadPoolBoundHandle ILLink descriptor — the workaround (preserving .interfaceimpl when the type is not instantiated on Unix) was fixed in the linker long ago (mono/linker#649).

Behavioral note: On Browser/Wasi without managed threads, PreAllocatedOverlapped constructor now validates callback is non-null and allocates a ThreadPoolBoundHandleOverlapped (matching Unix behavior), instead of being a complete no-op. This is intentional and harmless since BindHandle still throws, making the object unusable.

Copilot AI and others added 2 commits March 12, 2026 18:05
…pped.Unix.cs, remove ILLink workaround

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

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

Labels

area-System.Threading linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants