[browser][coreCLR] implement JS interop#123131
Merged
pavelsavara merged 6 commits intodotnet:mainfrom Jan 14, 2026
Merged
Conversation
- consume SystemInteropJS_* as LibraryImport for CoreCLR and keep Icall for Mono - JavaScriptExports as UnmanagedCallersOnly for CoreCLR and keep reflection for Mono - BindManagedFunction via reclection on C# side for CoreCLR, keep C API for Mono reflection - disable HTTP test until implemented dotnet#120216 - more _ems_ prefix for emscripten functions, EmsAmbientSymbolsType rename and move - register forceDisposeProxies into exit sequence - implement I53 memory operations - implement JS interop with camelCase names - pass JS interop unit tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements JavaScript interop functionality for CoreCLR on the browser platform with camelCase naming conventions. It introduces significant infrastructure for marshaling data between JavaScript and C#, handling promises/tasks, managing object lifetimes, and providing bidirectional function calls.
Changes:
- Implements complete JS interop marshaling system with type-safe conversions between JS and C# types
- Adds CoreCLR-specific implementations separate from Mono using LibraryImport and UnmanagedCallersOnly
- Implements I53 (53-bit integer) memory operations for safe integer marshaling
- Establishes reverse PInvoke infrastructure for C++ to call managed JavaScript exports
Reviewed changes
Copilot reviewed 46 out of 48 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/rollup.config.plugins.js | Suppresses circular dependency warnings for marshal files |
| src/native/libs/System.Runtime.InteropServices.JavaScript.Native/native/index.ts | Implements SystemInteropJS_* exports for JS interop |
| src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/*.ts | Core marshaling, type definitions, and interop logic |
| src/native/libs/System.Native.Browser/utils/*.ts | Adds I53 operations and updates to use ems ambient symbols |
| src/native/libs/Common/JavaScript/types/*.ts | Type definitions for EmsAmbientSymbolsType and exchanges |
| src/libraries/System.Runtime.InteropServices.JavaScript/src/*.cs | Splits Mono/CoreCLR implementations |
| src/coreclr/vm/wasm/callhelpers-reverse.cpp | Adds reverse PInvoke thunks for JavaScriptExports |
| src/mono/sample/wasm/browser/* | Updates sample to test JSExport functionality |
3 tasks
Member
Author
|
maraf
approved these changes
Jan 14, 2026
...e.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSProxyContext.cs
Outdated
Show resolved
Hide resolved
…stem/Runtime/InteropServices/JavaScript/JSProxyContext.cs Co-authored-by: Marek Fišera <[email protected]>
safeSetTimeout public stringToUTF8 fix JSExportByHandle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #120703