Skip to content

[browser] runtimeConfig via boot config #115113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 15, 2025

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Apr 28, 2025

  • extend BootJsonData with runtimeConfig which matches just the runtimeOptions.configProperties part of *.runtimeconfig.json
  • load RuntimeConfigJsonPath in GenerateWasmBootJson and in WasmAppBuilder
  • drop RuntimeConfigParserTask from browser and move it to WASI msbuild
  • convert from json to char** in startup.ts
  • library mode initialize_runtime() out of scope
export const config = /*json-start*/{
  "mainAssemblyName": "Wasm.Browser.Sample.dll",
  "debugLevel": -1,
  "globalizationMode": "sharded",
  ...
  "runtimeConfig": {
    "runtimeOptions": {
      "configProperties": {
        "System.Net.Http.WasmEnableStreamingResponse": true,
        "Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability": true,
        ...
      }
    }
  }
}/*json-end*/;

Fixes #97449
Fixes #112442
Together with dotnet/sdk#48916

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm labels Apr 28, 2025
@pavelsavara pavelsavara added this to the 10.0.0 milestone Apr 28, 2025
@pavelsavara pavelsavara self-assigned this Apr 28, 2025
Copy link
Contributor

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

@pavelsavara pavelsavara force-pushed the browser_runtimeConfig branch from 8c54cf7 to 3a1d153 Compare May 9, 2025 19:00
@pavelsavara pavelsavara marked this pull request as ready for review May 13, 2025 16:26
@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 16:26
Copy link
Contributor

@Copilot 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 extends the boot configuration for browser-based apps by adding support for runtime configuration properties, refactoring runtime config parsing, and updating related tests. Key changes include:

  • Adding the runtimeConfig property (and supporting types) to BootJsonData.
  • Refactoring the runtime configuration loading in startup.ts and driver.c.
  • Updating MSBuild targets and test projects to use the new runtime configuration mechanism.

Reviewed Changes

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

Show a summary per file
File Description
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs Added runtimeConfig property and new types for runtime configuration data.
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js Added a new test case branch for HttpNoStreamingTest with runtime config access.
src/mono/wasm/testassets/WasmBasicTestApp/App/HttpTest.cs Introduced HttpNoStreamingTest logic using the runtime config switch.
src/mono/wasm/testassets/WasmBasicTestApp/App/EnvVariablesTest.cs Updated logging format in environment variable test output.
src/mono/wasm/build/* and src/mono/wasi/build/* Removed references to RuntimeConfigParserTask; updated targets to use ProjectRuntimeConfigFilePath.
src/mono/browser/runtime/* Updated types and startup logic to convert runtime config properties from JSON to char** arrays and adjust the native runtime initialization.
src/mono/browser/runtime/driver.c Updated the mono_wasm_load_runtime signature and initialization to reflect runtime config changes.
src/mono/browser/runtime/cwraps.ts Updated the function signature for mono_wasm_load_runtime.
Other test and project files Adjusted tests and project definitions to align with runtime config changes.

@lewing
Copy link
Member

lewing commented May 14, 2025

test failures look relevant

@pavelsavara pavelsavara merged commit 9a83ba8 into dotnet:main May 15, 2025
31 of 33 checks passed
@pavelsavara pavelsavara deleted the browser_runtimeConfig branch May 15, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
3 participants