Skip to content

Only include System.Runtime.InteropServices.JavaScript in coreAssembly for Mono#130771

Open
pavelsavara with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-issue-122392
Open

Only include System.Runtime.InteropServices.JavaScript in coreAssembly for Mono#130771
pavelsavara with Copilot wants to merge 2 commits into
mainfrom
copilot/implement-issue-122392

Conversation

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #122392

System.Runtime.InteropServices.JavaScript.dll is only required to start the Mono runtime on browser-wasm; CoreCLR does not need it to boot. It should therefore only be listed in the boot config's coreAssembly group when targeting Mono.

Changes

  • BootJsonBuilderHelper: Added an IsMonoRuntime constructor flag. System.Private.CoreLib remains core for both runtimes; System.Runtime.InteropServices.JavaScript moved to a Mono-only core assembly list that is consulted only when IsMonoRuntime is set.
  • GenerateWasmBootJson task: Added a UseMonoRuntime string parameter and computes the flag as !equals("false"), so unset/empty (the Mono default) preserves existing behavior and only UseMonoRuntime=false (CoreCLR) excludes the JS assembly.
  • Microsoft.NET.Sdk.WebAssembly.Browser.targets: Passes UseMonoRuntime="$(UseMonoRuntime)" to both build and publish invocations and adds it to the incremental build/publish stamp content so the boot config regenerates when the runtime flavor changes.

Copilot AI review requested due to automatic review settings July 15, 2026 11:09
Copilot AI removed the request for review from Copilot July 15, 2026 11:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@pavelsavara pavelsavara marked this pull request as ready for review July 15, 2026 14:12
@pavelsavara pavelsavara requested a review from lewing as a code owner July 15, 2026 14:12
Copilot AI review requested due to automatic review settings July 15, 2026 14:12
@pavelsavara pavelsavara requested a review from akoeplinger as a code owner July 15, 2026 14:12
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adjusts WebAssembly boot config generation so System.Runtime.InteropServices.JavaScript.dll is only treated as a core boot-time assembly when targeting the Mono runtime, avoiding unnecessary inclusion for CoreCLR.

Changes:

  • Adds a UseMonoRuntime task parameter and derives an isMonoRuntime flag in GenerateWasmBootJson.
  • Extends BootJsonBuilderHelper with an IsMonoRuntime constructor flag and makes System.Runtime.InteropServices.JavaScript core-only for Mono.
  • Plumbs $(UseMonoRuntime) through Microsoft.NET.Sdk.WebAssembly.Browser.targets and includes it in the incremental stamp content so boot config regenerates when the runtime flavor changes.

Reviewed changes

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

File Description
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs Adds UseMonoRuntime input and passes computed runtime-flavor flag into boot JSON building.
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs Makes “core assembly” classification depend on runtime flavor, keeping JS interop core-only for Mono.
src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets Passes UseMonoRuntime into GenerateWasmBootJson and adds it to build/publish stamp content for incrementality correctness.

@akoeplinger

Copy link
Copy Markdown
Member

LGTM apart from one comment

Copilot AI review requested due to automatic review settings July 15, 2026 15:03
@pavelsavara pavelsavara temporarily deployed to copilot-pat-pool July 15, 2026 15:03 — with GitHub Actions Inactive
@pavelsavara pavelsavara temporarily deployed to copilot-pat-pool July 15, 2026 15:04 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs:22

  • BootJsonBuilderHelper is a public type in the WebAssembly SDK tasks assembly. Changing the primary constructor signature is a source/binary breaking change for any external consumers that new up this helper directly. Consider adding a compat constructor overload with the previous signature that forwards to the new one (defaulting IsMonoRuntime to true to preserve prior behavior).
    public class BootJsonBuilderHelper(TaskLoggingHelper Log, string DebugLevel, bool IsMultiThreaded, bool IsPublish, Version TargetFrameworkVersion, bool IsMonoRuntime)
    {
#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'.
        internal static readonly Regex mergeWithPlaceholderRegex = new Regex(@"/\*!\s*dotnetBootConfig\s*\*/\s*{}");
        internal static readonly Regex bundlerFriendlyImportsRegex = new Regex(@"/\*!\s*bundlerFriendlyImports\s*\*/");

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.

[browser][coreCLR] do not include System.Runtime.InteropServices.JavaScript.dll in coreAssembly of boot config

4 participants