Skip to content

Fix multithreaded browser-wasm build: CS0102 errors in PortableThreadPool; remove redundant ThreadPoolBoundHandle.Browser.Threads.cs; regenerate WASM call helpers#125887

Merged
jkotas merged 5 commits intomainfrom
copilot/fix-multithreaded-browser-wasm-build
Mar 22, 2026
Merged

Fix multithreaded browser-wasm build: CS0102 errors in PortableThreadPool; remove redundant ThreadPoolBoundHandle.Browser.Threads.cs; regenerate WASM call helpers#125887
jkotas merged 5 commits intomainfrom
copilot/fix-multithreaded-browser-wasm-build

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

Fix build breaks introduced by #125507 (comment)

Copilot AI changed the title Fix multithreaded browser-wasm build: CS0260 and CS0102 errors in ThreadPoolBoundHandle/PortableThreadPool Fix multithreaded browser-wasm build: CS0102 errors in PortableThreadPool; remove redundant ThreadPoolBoundHandle.Browser.Threads.cs Mar 21, 2026
Copilot AI requested a review from jkotas March 21, 2026 13:53
@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.

@jkotas
Copy link
Member

jkotas commented Mar 21, 2026

@copilot Fix build breaks

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems(2870,95): error MSB4092: (NETCORE_ENGINEERING_TELEMETRY=Restore) An unexpected token "==" was found at character position 60 in condition "'$(TargetsWindows)' != 'true' and not ('$(TargetsBrowser)' == 'true' and '$(FeatureMultithreading)' == 'true')".  

Copy link
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot Fix build breaks

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems(2870,95): error MSB4092: (NETCORE_ENGINEERING_TELEMETRY=Restore) An u...

Fixed in 9e1283b. MSBuild doesn't support not (...), replaced with the De Morgan equivalent: ('$(TargetsBrowser)' != 'true' or '$(FeatureMultithreading)' != 'true').

@jkotas
Copy link
Member

jkotas commented Mar 21, 2026

/azp run runtime-extra-platforms

@jkotas jkotas marked this pull request as ready for review March 21, 2026 14:20
Copilot AI review requested due to automatic review settings March 21, 2026 14:20
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 fixes multithreaded Browser WASM (TargetsBrowser=true + FeatureMultithreading=true) build breaks in CoreLib caused by duplicate type/member definitions from overlapping platform-specific source inclusions.

Changes:

  • Remove ThreadPoolBoundHandle.Browser.Threads.cs and its projitems entry to avoid conflicting ThreadPoolBoundHandle definitions with the non-Windows ThreadPoolBoundHandle.PlatformNotSupported.cs.
  • Update the PortableThreadPool.Unix.cs compile condition to exclude it for multithreaded Browser WASM builds, avoiding duplicate CpuUtilizationReader / WorkerThread.IsIOPending members with PortableThreadPool.Browser.Threads.cs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolBoundHandle.Browser.Threads.cs Deletes a redundant Browser+threads-specific partial that conflicts with the non-Windows PlatformNotSupported implementation.
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems Adjusts MSBuild compile conditions to prevent Unix and Browser.Threads variants from being included together in multithreaded Browser WASM builds.

@jkotas
Copy link
Member

jkotas commented Mar 21, 2026

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member

jkotas commented Mar 21, 2026

@copilot Regenerate wasm call helpers under https://github.com/dotnet/runtime/tree/main/src/coreclr/vm/wasm

Copy link
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot Regenerate wasm call helpers under https://github.com/dotnet/runtime/tree/main/src/coreclr/vm/wasm

Done in 312fed0. Built the browser-wasm runtime locally and regenerated the call helpers. Changes: new P/Invoke entries (SystemNative_FcntlGetIsNonBlocking, SystemNative_Pipe, SystemNative_ReadFromNonblocking, SystemNative_WriteToNonblocking), new reverse P/Invoke entries for TypeMapLazyDictionary.NewPrecachedExternalTypeMap/NewPrecachedProxyTypeMap, and updated interp-to-managed thunk signatures.

Copilot AI changed the title Fix multithreaded browser-wasm build: CS0102 errors in PortableThreadPool; remove redundant ThreadPoolBoundHandle.Browser.Threads.cs Fix multithreaded browser-wasm build: CS0102 errors in PortableThreadPool; remove redundant ThreadPoolBoundHandle.Browser.Threads.cs; regenerate WASM call helpers Mar 21, 2026
Copilot AI requested a review from jkotas March 21, 2026 15:04
@jkotas
Copy link
Member

jkotas commented Mar 22, 2026

/ba-g infrastructure timeout

@jkotas jkotas merged commit 6260db3 into main Mar 22, 2026
158 of 160 checks passed
@jkotas jkotas deleted the copilot/fix-multithreaded-browser-wasm-build branch March 22, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants