diff --git a/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts b/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts index 4763f17f8794..6c625e95d779 100644 --- a/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts +++ b/src/Uno.UI/ts/Windows/Storage/StorageFolder.ts @@ -69,9 +69,13 @@ namespace Windows.Storage { private static onStorageInitialized() { if (!StorageFolder.dispatchStorageInitialized) { - StorageFolder.dispatchStorageInitialized = - (Module).mono_bind_static_method( - "[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized"); + if ((globalThis).DotnetExports !== undefined) { + StorageFolder.dispatchStorageInitialized = (globalThis).DotnetExports.Uno.Windows.Storage.StorageFolder.DispatchStorageInitialized; + } else { + StorageFolder.dispatchStorageInitialized = + (Module).mono_bind_static_method( + "[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized"); + } } StorageFolder.dispatchStorageInitialized(); } diff --git a/src/Uno.UWP/Storage/StorageFolder.wasm.cs b/src/Uno.UWP/Storage/StorageFolder.wasm.cs index 4d83ef32a94d..cc1ae61f15f0 100644 --- a/src/Uno.UWP/Storage/StorageFolder.wasm.cs +++ b/src/Uno.UWP/Storage/StorageFolder.wasm.cs @@ -9,6 +9,10 @@ using System.Threading.Tasks; using Uno.Foundation.Logging; +#if NET7_0_OR_GREATER +using System.Runtime.InteropServices.JavaScript; +#endif + namespace Windows.Storage { partial class StorageFolder @@ -54,6 +58,9 @@ private struct StorageFolderMakePersistentParams public string[] Paths; } +#if NET7_0_OR_GREATER + [JSExport] +#endif internal static void DispatchStorageInitialized() { if (typeof(StorageFolder).Log().IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))