diff --git a/src/Uno.Wasm.Bootstrap/ShellTask.cs b/src/Uno.Wasm.Bootstrap/ShellTask.cs index 96dc6c31..972ebe9d 100644 --- a/src/Uno.Wasm.Bootstrap/ShellTask.cs +++ b/src/Uno.Wasm.Bootstrap/ShellTask.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Net; using System.Runtime.InteropServices; +using System.Security; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; @@ -157,6 +158,7 @@ public override bool Execute() // Debugger.Launch(); + PreloadAssemblies(); TryEnableLongPathAware(); ParseProperties(); GetBcl(); @@ -184,6 +186,20 @@ public override bool Execute() } } + private void PreloadAssemblies() + { + // Under some circumstances, the assemblies bundled with the bootstrapper do not + // get loaded properly by .NET Core. This is method forces the loading of those + // assemblies in order to let the loading find them automatically. + + var path = Path.GetDirectoryName(new Uri(GetType().Assembly.GetName().CodeBase).LocalPath); + + foreach (var file in Directory.GetFiles(path, "*.dll")) + { + _ = System.Reflection.Assembly.LoadFile(Path.Combine(path, file)); + } + } + private void TryEnableLongPathAware() { if (EnableLongPathSupport)