Skip to content

Commit

Permalink
[NUI.Gadget] Change assembly load mothod (Samsung#5914)
Browse files Browse the repository at this point in the history
- Use LoadFromNativeImagePath() instead of LoadFromStream()

Signed-off-by: Hwankyu Jhun <[email protected]>
  • Loading branch information
hjhun authored Jan 26, 2024
1 parent ce361fd commit 5b6d36e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Tizen.NUI.Gadget/Tizen.NUI/NUIGadgetAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using System.Reflection;
using System.Runtime.Loader;

using SystemIO = System.IO;

namespace Tizen.NUI
{
internal class NUIGadgetAssemblyLoadContext : AssemblyLoadContext
Expand Down Expand Up @@ -54,10 +56,11 @@ public void Load()
Log.Warn("Load(): " + _assemblyPath + " ++");
NUIGadgetAssemblyLoadContext context = new NUIGadgetAssemblyLoadContext();
_assemblyRef = new WeakReference(context);
using (MemoryStream memoryStream = new MemoryStream(File.ReadAllBytes(_assemblyPath)))
{
_assembly = context.LoadFromStream(memoryStream);
}
string directoryPath = SystemIO.Path.GetDirectoryName(_assemblyPath);
string fileName = SystemIO.Path.GetFileNameWithoutExtension(_assemblyPath);
string nativeImagePath = directoryPath + "/" + fileName + ".ni.dll";
Log.Debug("NativeImagePath=" + nativeImagePath + ", AssemblyPath=" + _assemblyPath);
_assembly = context.LoadFromNativeImagePath(nativeImagePath, _assemblyPath);
Log.Warn("Load(): " + _assemblyPath + " --");
}
}
Expand Down

0 comments on commit 5b6d36e

Please sign in to comment.