2008-09-08 Mike Kestner <mkestner@novell.com>

* glib/GType.cs: beef up the referenced assembly loading code to
	handle assemblies located in the same directory as the referring
	assembly.  Fixes #423450.

svn path=/trunk/gtk-sharp/; revision=112545
This commit is contained in:
Mike Kestner 2008-09-08 20:52:27 +00:00
parent a4bc03d66d
commit fdfff5bb60
2 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2008-09-08 Mike Kestner <mkestner@novell.com>
* glib/GType.cs: beef up the referenced assembly loading code to
handle assemblies located in the same directory as the referring
assembly. Fixes #423450.
2008-09-05 Andrés G. Aragoneses <aaragoneses@novell.com>
Fixes BNC#387220.

View file

@ -24,6 +24,7 @@ namespace GLib {
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
@ -158,13 +159,19 @@ namespace GLib {
visited [asm] = asm;
Type result = asm.GetType (type_name);
if (result == null)
if (result == null) {
string asm_dir = Path.GetDirectoryName (asm.Location);
foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) {
Assembly ref_asm = Assembly.Load (ref_name);
Assembly ref_asm;
if (File.Exists (Path.Combine (asm_dir, ref_name.Name + ".dll")))
ref_asm = Assembly.LoadFrom (Path.Combine (asm_dir, ref_name.Name + ".dll"));
else
ref_asm = Assembly.Load (ref_name);
result = FindTypeInReferences (type_name, ref_asm, visited);
if (result != null)
break;
}
}
return result;
}