Skip to content

[wasm][coreclr] Call-helper generation fails when the bundle contains an assembly deployed under a different file name #134915

Description

@lewing

Description

CoreCLR WebAssembly app builds generate per-app call helpers by running crossgen2 with
--generate-portable-callhelpers over every managed assembly in the bundle
(WasiApp.CoreCLR.targets _WasiCoreCLRRelinkCoreRun; BrowserWasmApp.CoreCLR.targets uses the
same FilterManagedAssemblies step). crossgen2 requires each input's assembly name to match its file
name (CompilerTypeSystemContext), so the build fails when an app deploys an assembly under another
file name and loads it by path.

System.Runtime.Loader.DefaultContext.Tests does exactly this: it deploys
System.Runtime.Loader.Noop.Assembly as System.Runtime.Loader.Noop.Assembly_test.dll. WASI CoreCLR
relinks the host for every app, so it always runs the generator and fails. Browser CoreCLR runs the
generator only when the app is relinked (WasmBuildNative), so the browser library lanes, which use the
prebuilt runtime for this suite, don't hit it. A relinked browser app that deploys such an assembly
would fail the same way: both platforms pass every published .dll to the generator.

EXEC : error : Assembly name does not match filename .../System.Runtime.Loader.DefaultContext.Tests/Release/net11.0/wasi-wasm/AppBundle/managed/System.Runtime.Loader.Noop.Assembly_test.dll
src/mono/wasi/build/WasiApp.CoreCLR.targets(283,5): error MSB3073: The command ".../crossgen2" "@.../callhelpers-generator.rsp" exited with code 1.

Seen in the wasi-wasm linux Release LibraryTestsCoreCLR_WASI lane of
#134813
(build 1617382).

Expected

Assemblies deployed under another file name are still loaded at runtime, so their P/Invoke and
reverse P/Invoke signatures need call helpers. Skipping them would avoid the build error but can
leave missing helpers that only fail at runtime. A possible fix is to stage a copy named after the
assembly's metadata name for the generator, leaving the bundle layout unchanged.

Re-enable

Remove the WASI CoreCLR ProjectExclusions entry for
System.Runtime.Loader.DefaultContext.Tests in src/libraries/tests.proj once call-helper
generation accepts such assemblies.

Note

This issue was drafted with the help of GitHub Copilot.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions