Use executables when trying to resolve an assembly 72/108672/1
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 5 Jan 2017 09:22:46 +0000 (10:22 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 5 Jan 2017 10:04:42 +0000 (11:04 +0100)
Some applications define types referenced from XAML in the executable
files, this commit handles such cases.

Change-Id: I422e7ad1b8d463c8afac663a4eab58cd150c983a
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs

index 35a8ddf..3423d80 100755 (executable)
@@ -29,14 +29,16 @@ namespace Tizen.Runtime.Coreclr
 
         private const string DllAssemblySuffix = ".dll";
 
+        private const string ExeAssemblySuffix = ".exe";
+
         private const string NativeDllAssemblySuffix = NativeAssemblyInfix + DllAssemblySuffix;
 
-        private static readonly string[] s_suffixes = new string[] { NativeDllAssemblySuffix, DllAssemblySuffix };
+        private static readonly string[] s_suffixes = new string[] { NativeDllAssemblySuffix, DllAssemblySuffix, ExeAssemblySuffix };
 
         private SortedSet<string> _dllDirectories = new SortedSet<string>();
         private SortedSet<string> _nativeDirectories = new SortedSet<string>();
 
-        private HashSet<FileInfo> _dllCache = new HashSet<FileInfo>();
+        private HashSet<FileInfo> _assemblyCache = new HashSet<FileInfo>();
 
         public AssemblyLoader()
         {
@@ -64,9 +66,9 @@ namespace Tizen.Runtime.Coreclr
                 {
                     var info = new FileInfo(file);
 
-                    if (info.Extension == DllAssemblySuffix)
+                    if (s_suffixes.Contains(info.Extension))
                     {
-                        _dllCache.Add(info);
+                        _assemblyCache.Add(info);
                     }
                 }
             }
@@ -77,7 +79,7 @@ namespace Tizen.Runtime.Coreclr
             _dllDirectories.Remove(directory);
             _nativeDirectories.Remove(directory);
 
-            _dllCache.RemoveWhere(x => x.DirectoryName == directory);
+            _assemblyCache.RemoveWhere(x => x.DirectoryName == directory);
         }
 
         public Assembly LoadFromPath(string path)
@@ -125,7 +127,7 @@ namespace Tizen.Runtime.Coreclr
         {
             foreach (string suffix in s_suffixes)
             {
-                var info = _dllCache.FirstOrDefault(x => x.Name == assemblyName.Name + suffix);
+                var info = _assemblyCache.FirstOrDefault(x => x.Name == assemblyName.Name + suffix);
 
                 if (info != null)
                 {