-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[browser] Support CoreCLR in WebAssembly SDK #122495
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
Conversation
There was a problem hiding this 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 enables CoreCLR runtime support in the WebAssembly SDK infrastructure. Currently, the Wasm SDK was designed primarily for the Mono runtime, and this work adapts it to support building and testing WebAssembly applications with CoreCLR as well.
Key changes include:
- Adding CoreCLR package identifiers to runtime pack detection logic
- Creating CoreCLR-specific build targets and property defaults
- Extending Wasm.Build.Tests to run with CoreCLR using plain .NET SDK with runtime override
- Adding a simple test asset (WasmBrowserRunMainOnly) for CoreCLR validation
Reviewed changes
Copilot reviewed 34 out of 34 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/AssetsComputingHelper.cs | Adds CoreCLR package IDs to runtime pack detection |
| src/native/corehost/corehost.proj | Copies native JS/Wasm assets to CoreCLR runtime pack |
| src/native/corehost/browserhost/host/host.ts | Adds .dll extension to mainAssemblyName if missing |
| src/mono/wasm/testassets/WasmBrowserRunMainOnly/* | New test asset for basic CoreCLR wasm testing |
| src/mono/wasm/Wasm.Build.Tests/* | Extends test infrastructure to support CoreCLR execution |
| src/mono/browser/build/* | Adds CoreCLR-specific build targets and property defaults |
| src/coreclr/.nuget/coreclr-packages.proj | Includes Wasm SDK packages in CoreCLR package build |
| eng/testing/* | Updates test configuration to conditionally run workload-based tests and add CoreCLR runtime pack references |
| eng/pipelines/* | Adds CI job for CoreCLR Wasm.Build.Tests |
Comments suppressed due to low confidence (1)
src/native/corehost/corehost.proj:1
- Corrected spelling of 'altough' to 'although'.
Co-authored-by: Copilot <[email protected]>
|
Wasm.Build.Tests.WasmBrowserRunMainOnly.RunMainOnly 🎉 |
coreclr-packages.proj)dotnet-none) with overrides to use CoreCLR (/p:UseMonoRuntime=false) and points packages to those built from the repository/t:RunSample.dllif missing toconfig.mainAssemblyNamebefore running itFixes #120647
Some issues discovered when running various tests
.dllRemoveLoopServerAddTestRunnersToPublishedFiles->ComputeResolvedFilesToPublishList->WasmTriggerPublishAppwith***function in test-main.js are undefined on CoreCLR - [browser][mono] simplify internal testing switches #122616Assembly.LoadFrom(TestAssembly). Mono knows "app" assemblies are loaded; CoreCLR requires to load them through VFSsrc/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets(241,37): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Build) The target "WasmTriggerPublishApp" does not exist in the project.The runtime pack now contains all the necessary files

Errors
Xharness with symbolicator fails
FileNotFoundException: Could not load file or assembly '/System.Console.Tests.dll'
``` dotnet.js:945 DOTNET: FileNotFoundException: Could not load file or assembly '/System.Console.Tests.dll'. The system cannot find the file specified.at System.Runtime.Loader.AssemblyLoadContext.g____PInvoke|5_0(:63603/IntPtr __ptrNativeAssemblyBinder_native, UInt16* __ilPath_native, UInt16* __niPath_native, ObjectHandleOnStack __retAssembly_native)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(:63603/IntPtr ptrNativeAssemblyBinder, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.InternalLoadFromPath(:63603/String assemblyPath, String nativeImagePath)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(:63603/String assemblyPath)
at System.Reflection.Assembly.LoadFrom(:63603/String assemblyFile)
at Microsoft.DotNet.XHarness.TestRunners.Xunit.WasmApplicationEntryPoint.GetTestAssemblies(index.html?arg=--run&arg=WasmTestRunner.dll&arg=System.Console.Tests.dll&arg=-notrait&arg=category%…)
at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(:63603/LogWriter logger)
at Microsoft.DotNet.XHarness.TestRunners.Common.ApplicationEntryPoint.InternalRunAsync(:63603/ApplicationOptions options, TextWriter loggerWriter, TextWriter resultsFile)
at Microsoft.DotNet.XHarness.TestRunners.Common.WasmApplicationEntryPointBase.RunAsync(index.html?arg=--run&arg=WasmTestRunner.dll&arg=System.Console.Tests.dll&arg=-notrait&arg=category%…)
at Microsoft.DotNet.XHarness.TestRunners.Xunit.WasmApplicationEntryPoint.Run(index.html?arg=--run&arg=WasmTestRunner.dll&arg=System.Console.Tests.dll&arg=-notrait&arg=category%…)
at WasmTestRunner.MainAsync(:63603/String[] args)