Skip to content

Parse runtime configuration at app build time - #137926

Merged
akoeplinger merged 4 commits into
mainfrom
akoeplinger-runtime-config-modernization
Nov 20, 2026
Merged

akoeplinger merged 4 commits into
mainfrom
akoeplinger-runtime-config-modernization

Conversation

@akoeplinger

Copy link
Copy Markdown
Member

Summary

  • replace Android and Apple app-builder consumption of runtimeconfig.bin with direct JSON parsing through a shared helper
  • generate deterministic per-app C++ runtime properties for CoreCLR WASI and link them into wasihost
  • remove runtime runtimeconfig.bin parsing from wasihost and obsolete binary-config handling from the app-builder templates
  • keep the existing RuntimeConfigParser implementation and package for the later cleanup slice

This PR is stacked on akoeplinger-runtime-test-cleanup.

Validation

  • ./build.sh clr+libs+host -rc release -lc release — passed
  • ./build.sh tasks — passed
  • Android, Apple, and WASI app-builder project builds in Debug and Release — passed
  • ./build.sh host.native -os wasi -arch wasm -c Debug — passed
  • ./build.sh host.native -os wasi -arch wasm -c Release — passed
  • ./build.sh clr+libs+packs -os wasi -arch wasm -c Release — passed
  • CoreCLR-WASI console sample clean publish and execution under wasmtime — passed
  • ad hoc integration validation for comments, trailing commas, strings, booleans, 32-bit integers, missing files, reserved properties, deterministic ordering, and C string escaping — passed

Note

This pull request description was generated with GitHub Copilot.

@azure-pipelines

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

Removing Mono’s binary configuration path silently drops configured AppContext values, while leaving ConfigProperties uninitialized causes valid runtimeconfig files without custom properties to throw.

2 open issues
What changed in this PR

Moves runtime configuration processing into the app-build pipeline, sharing JSON parsing across app builders and linking generated configuration properties into CoreCLR’s WASI host.

Changes:

  • Adds shared JSON parsing, reserved-property validation, and C-string escaping.
  • Updates Android and Apple CoreCLR builders to generate properties directly from JSON.
  • Generates and links per-app WASI property tables, removing binary configuration handling from affected targets and templates.
File Description
src/​tasks/​WasmAppBuilder/​WasmAppBuilder.csproj Includes the shared configuration helper.
src/​tasks/​WasmAppBuilder/​wasi/​WasiAppBuilder.cs Generates sorted C++ configuration tables.
src/​tasks/​Common/​RuntimeConfigProperties.cs Adds JSON parsing, validation, and string escaping.
src/​tasks/​AppleAppBuilder/​Xcode.cs Generates CoreCLR properties from JSON.
src/​tasks/​AppleAppBuilder/​Templates/​runtime.m Removes Mono binary configuration loading.
src/​tasks/​AppleAppBuilder/​AppleAppBuilder.csproj Includes the shared configuration helper.
src/​tasks/​AppleAppBuilder/​AppleAppBuilder.cs Passes the configuration path to project generation.
src/​tasks/​AndroidAppBuilder/​Templates/​monodroid.c Removes Mono binary configuration loading.
src/​tasks/​AndroidAppBuilder/​Templates/​monodroid-coreclr.c Removes the unused binary configuration filename macro.
src/​tasks/​AndroidAppBuilder/​ApkBuilder.cs Generates sorted, escaped CoreCLR properties from JSON.
src/​tasks/​AndroidAppBuilder/​AndroidAppBuilder.csproj Includes the shared configuration helper.
src/​tasks/​AndroidAppBuilder/​AndroidAppBuilder.cs Passes the configuration path to the APK builder.
src/​native/​corehost/​wasihost/​wasihost.cpp Uses linked property tables instead of parsing binary configuration.
src/​native/​corehost/​wasihost/​CMakeLists.txt Documents the generated configuration link input.
src/​mono/​wasi/​build/​WasiApp.targets Wires source generation and removes binary configuration packaging.
src/​mono/​wasi/​build/​WasiApp.CoreCLR.targets Compiles and links generated configuration properties.
src/​mono/​msbuild/​apple/​build/​AppleBuild.targets Passes JSON directly and removes binary generation.
src/​mono/​msbuild/​android/​build/​AndroidBuild.targets Passes JSON directly and removes binary generation.
eng/​testing/​tests.wasi.targets Updates a comment about WASI feature-switch propagation.

Review effort: Balanced

steveisok
steveisok previously approved these changes Nov 19, 2026

@steveisok steveisok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside of the one copilot review, lgtm

@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Nov 20, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@akoeplinger

Copy link
Copy Markdown
Member Author

/ba-g unrelated infra failures

@akoeplinger
akoeplinger merged commit 69a4893 into main Nov 20, 2026
106 of 109 checks passed
@akoeplinger
akoeplinger deleted the akoeplinger-runtime-config-modernization branch November 20, 2026 11:40
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 23, 2026
lewing added a commit to lewing/runtime that referenced this pull request Nov 23, 2026
…allHelpersAsWasm

dotnet#137926 compiles a generated runtimeconfig.cpp (the g_runtimeconfig_keys and
g_runtimeconfig_values string arrays and g_runtimeconfig_property_count) in
the relink, so object mode needed clang again. WasiAppBuilder now writes the
same three symbols as a relocatable wasm32 object with the toolchain's
encoders when given RuntimeConfigPropertiesObjectPath, and the relink links
it next to callhelpers.o.

A harness that prints the arrays gives identical output linked against this
object and against clang's object for the same runtimeconfig.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Build-mono linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants