Fix unused native image in application.
[platform/core/dotnet/launcher.git] / Tizen.Runtime / Tizen.Runtime.Coreclr / AssemblyManager.cs
index ea31f8f..26b8868 100644 (file)
@@ -165,7 +165,16 @@ namespace Tizen.Runtime.Coreclr
                 FileInfo f = new FileInfo(dllPath);
                 if (File.Exists(f.FullName))
                 {
-                    Assembly asm = CurrentAssemblyLoaderContext.LoadFromAssemblyPath(f.FullName);
+                    Assembly asm = null;
+                    if (0 == string.Compare(f.FullName, f.FullName.Length - 7, ".ni", 0, 3, StringComparison.OrdinalIgnoreCase))
+                    {
+                        asm = CurrentAssemblyLoaderContext.LoadFromNativeImagePath(f.FullName, null);
+                    }
+                    else
+                    {
+                        asm = CurrentAssemblyLoaderContext.LoadFromAssemblyPath(f.FullName);
+                    }
+
                     if (asm == null) throw new FileNotFoundException($"{f.FullName} is not found");
                     if (asm.EntryPoint == null) throw new ArgumentException($"{f.FullName} did not have EntryPoint");
                     asm.EntryPoint.Invoke(null, new object[]{argv});