diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 27b37da25b8d5..50bc98ef0217f 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -375,12 +375,12 @@ export function prepareAssets () { if (config.loadAllSatelliteResources && resources.satelliteResources) { for (const culture in resources.satelliteResources) { for (const name in resources.satelliteResources[culture]) { - assetsToLoad.push({ + addAsset({ name, hash: resources.satelliteResources[culture][name], behavior: "resource", culture - }); + }, !resources.coreAssembly); } } } diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs index 3acee24e88536..b5cd463e17564 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs @@ -24,13 +24,19 @@ public SatelliteLoadingTests(ITestOutputHelper output, SharedBuildPerTestClassFi { } - [Fact, TestCategory("no-fingerprinting")] - public async Task LoadSatelliteAssembly() + [Theory, TestCategory("no-fingerprinting")] + [InlineData(false)] + [InlineData(true)] + public async Task LoadSatelliteAssembly(bool loadAllSatelliteResources) { CopyTestAsset("WasmBasicTestApp", "SatelliteLoadingTests", "App"); BuildProject("Debug"); - var result = await RunSdkStyleAppForBuild(new(Configuration: "Debug", TestScenario: "SatelliteAssembliesTest")); + var result = await RunSdkStyleAppForBuild(new( + Configuration: "Debug", + TestScenario: "SatelliteAssembliesTest", + BrowserQueryString: new Dictionary { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString() } + )); Assert.Collection( result.TestOutput, m => Assert.Equal("default: hello", m), diff --git a/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs b/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs index 23f3df8098cc5..cd4d9e1fe0cb4 100644 --- a/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs +++ b/src/mono/wasm/testassets/WasmBasicTestApp/App/SatelliteAssembliesTest.cs @@ -8,11 +8,12 @@ public partial class SatelliteAssembliesTest { [JSExport] - public static async Task Run() + public static async Task Run(bool loadSatelliteAssemblies) { ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false); - await LoadSatelliteAssemblies(new[] { "es-ES" }); + if (loadSatelliteAssemblies) + await LoadSatelliteAssemblies(new[] { "es-ES" }); ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, true); } diff --git a/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js b/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js index 75071104f676b..f8c357bc9a648 100644 --- a/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js +++ b/src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js @@ -28,6 +28,11 @@ dotnet // Modify runtime start based on test case switch (testCase) { + case "SatelliteAssembliesTest": + if (params.get("loadAllSatelliteResources") === "true") { + dotnet.withConfig({ loadAllSatelliteResources: true }); + } + break; case "AppSettingsTest": dotnet.withApplicationEnvironment(params.get("applicationEnvironment")); break; @@ -141,7 +146,7 @@ const assemblyExtension = Object.keys(config.resources.coreAssembly)[0].endsWith try { switch (testCase) { case "SatelliteAssembliesTest": - await exports.SatelliteAssembliesTest.Run(); + await exports.SatelliteAssembliesTest.Run(params.get("loadAllSatelliteResources") !== "true"); exit(0); break; case "LazyLoadingTest":