From 4a3f29faebc1a96ce5197a25934538d79f0b1687 Mon Sep 17 00:00:00 2001 From: Pawel Andruszkiewicz Date: Thu, 5 Jan 2017 10:22:46 +0100 Subject: [PATCH] Use executables when trying to resolve an assembly Some applications define types referenced from XAML in the executable files, this commit handles such cases. Change-Id: I422e7ad1b8d463c8afac663a4eab58cd150c983a Signed-off-by: Pawel Andruszkiewicz --- Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs b/Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs index 35a8ddf..3423d80 100755 --- a/Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs +++ b/Tizen.Runtime/Tizen.Runtime.Coreclr/AssemblyLoader.cs @@ -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 _dllDirectories = new SortedSet(); private SortedSet _nativeDirectories = new SortedSet(); - private HashSet _dllCache = new HashSet(); + private HashSet _assemblyCache = new HashSet(); 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) { -- 2.7.4