diff --git a/src/mono/sample/wasm/browser/main.js b/src/mono/sample/wasm/browser/main.js index 85aa33c9bad3f..27783085b924c 100644 --- a/src/mono/sample/wasm/browser/main.js +++ b/src/mono/sample/wasm/browser/main.js @@ -9,7 +9,6 @@ function displayMeaning(meaning) { try { const { setModuleImports } = await dotnet - .withMemoryCache() .withElementOnExit() .create(); diff --git a/src/mono/wasm/runtime/run-outer.ts b/src/mono/wasm/runtime/run-outer.ts index cbc5cb653b173..dd4be9b379e16 100644 --- a/src/mono/wasm/runtime/run-outer.ts +++ b/src/mono/wasm/runtime/run-outer.ts @@ -18,6 +18,7 @@ export interface DotnetHostBuilder { withDebugging(level: number): DotnetHostBuilder withMainAssembly(mainAssemblyName: string): DotnetHostBuilder withApplicationArgumentsFromQuery(): DotnetHostBuilder + withMemoryCache(value: boolean): DotnetHostBuilder create(): Promise run(): Promise } diff --git a/src/mono/wasm/runtime/startup.ts b/src/mono/wasm/runtime/startup.ts index ba887c337d05e..c38df52f77db8 100644 --- a/src/mono/wasm/runtime/startup.ts +++ b/src/mono/wasm/runtime/startup.ts @@ -352,7 +352,7 @@ async function mono_wasm_before_user_runtime_initialized(): Promise { mono_wasm_globalization_init(); if (!runtimeHelpers.mono_wasm_load_runtime_done) mono_wasm_load_runtime("unused", config.debugLevel); - if (runtimeHelpers.config.cacheMemory && !runtimeHelpers.memoryIsLoaded) { + if (config.cacheMemory && !runtimeHelpers.memoryIsLoaded) { await storeMemory(runtimeHelpers.configurationHash, Module.HEAP8.buffer); } bindings_init(); @@ -470,7 +470,7 @@ async function instantiate_wasm_module( if (runtimeHelpers.diagnosticTracing) console.debug("MONO_WASM: instantiate_wasm_module"); const assetToLoad = resolve_asset_path("dotnetwasm"); - if (runtimeHelpers.config.cacheMemory && config.assetsHash) { + if (config.cacheMemory && config.assetsHash) { memoryBytes = await getMemory(runtimeHelpers.configurationHash); runtimeHelpers.memoryIsLoaded = !!memoryBytes; } @@ -553,7 +553,7 @@ export function mono_wasm_load_runtime(unused?: string, debugLevel?: number): vo } endMeasure(mark, MeasuredBlock.loadRuntime); - if (!runtimeHelpers.config.cacheMemory) bindings_init(); + if (!config.cacheMemory) bindings_init(); } catch (err: any) { _print_error("MONO_WASM: mono_wasm_load_runtime () failed", err); @@ -602,7 +602,7 @@ export async function mono_wasm_load_config(configFilePath?: string): PromiseruntimeHelpers.config); + await Module.onConfigLoaded(config); normalizeConfig(); } catch (err: any) { @@ -631,7 +631,7 @@ export async function mono_wasm_load_config(configFilePath?: string): Promise