diff --git a/src/mono/wasm/runtime/library_mono.js b/src/mono/wasm/runtime/library_mono.js index 36837f62cf7096..e9cb8cd2b401d2 100644 --- a/src/mono/wasm/runtime/library_mono.js +++ b/src/mono/wasm/runtime/library_mono.js @@ -2365,12 +2365,14 @@ var MonoSupportLib = { }, /** - * Loads the mono config file (typically called mono-config.json) + * Loads the mono config file (typically called mono-config.json) asynchroniously + * Note: the run dependencies are so emsdk actually awaits it in order. * * @param {string} configFilePath - relative path to the config file * @throws Will throw an error if the config file loading fails */ - mono_wasm_load_config: async function (configFilePath) { + mono_wasm_load_config: async function (configFilePath) { + Module.addRunDependency(configFilePath); try { let config = null; // NOTE: when we add nodejs make sure to include the nodejs fetch package @@ -2385,6 +2387,8 @@ var MonoSupportLib = { return config; } catch(e) { return {message: "failed to load config file", error: e}; + } finally { + Module.removeRunDependency(configFilePath); } } },