Skip to content

Add Mono-compat loader shims to browserhost (withRuntimeOptions + legacy default export) - #133705

Closed
pavelsavara wants to merge 4 commits into
dotnet:mainfrom
pavelsavara:browser-host-with-runtime-options
Closed

pavelsavara wants to merge 4 commits into
dotnet:mainfrom
pavelsavara:browser-host-with-runtime-options

Conversation

@pavelsavara

@pavelsavara pavelsavara commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Restores backward compatibility with the Mono loader's DotnetHostBuilder / legacy entrypoint surface in the CoreCLR browserhost loader, without adding any of it to the announced public TypeScript definitions.

Changes

loader/host-builder.ts

  • Adds an internal withRuntimeOptions(runtimeOptions: string[]) method to HostBuilder, mirroring the Mono loader's method. It validates the argument is a string array and merges the options into the loader config.
  • Marked // internal and intentionally not added to the public DotnetHostBuilder type, so it stays off the announced API surface.

loader/dotnet.ts

  • Adds a legacy default export (export default legacyExport) matching the Mono loader's createDotnetRuntime / createEmscripten signature: it accepts a DotnetModuleConfig object or a (api) => DotnetModuleConfig factory, applies config via withConfig, assigns the module config onto Module, and returns dotnet.create(). This lets existing Mono-style consumers that import createDotnetRuntime from './dotnet.js' keep working.
  • Tightens the dotnet export type from DotnetHostBuilder | undefined to DotnetHostBuilder.

Validation

  • npm run rollup:debug compiles cleanly.

Note

This PR description was generated with AI assistance.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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 requested a review from maraf September 11, 2026 16:35
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Sep 11, 2026
@pavelsavara pavelsavara added this to the 12.0.0 milestone Sep 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@pavelsavara
pavelsavara marked this pull request as ready for review September 14, 2026 11:57
Copilot AI lite review requested due to automatic review settings September 14, 2026 11:57
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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.

🟡 Changes recommended

Merge DotnetModuleConfig.config into the loader configuration before creating the runtime.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds browserhost compatibility with Mono’s runtime-options API and legacy runtime entrypoint.

Changes:

  • Adds internal withRuntimeOptions.
  • Restores legacy runtime creation/export handling.
File summaries
File Summary
src/native/libs/Common/JavaScript/loader/host-builder.ts Adds runtime-options configuration support.
src/native/libs/Common/JavaScript/loader/dotnet.ts Adds legacy runtime creation support; config is not merged into loader configuration, so caller-supplied settings are ignored.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/native/libs/Common/JavaScript/loader/dotnet.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 14, 2026 12:25

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.

🟢 Approval recommended

The reviewed compatibility changes are complete with no unresolved blocking issues.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@pavelsavara pavelsavara changed the title Add internal withRuntimeOptions to browserhost HostBuilder for Mono compat Add Mono-compat loader shims to browserhost (withRuntimeOptions + legacy default export) Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants