G
Guest
Hi,
I'm trying to load a list of types from a dynamically
loaded assembly, e.g:
Assembly a = Assembly.LoadFrom(path);
a.ModuleResolve += new ModuleResolveEventHandler
(OnAssemblyModuleResolve);
types = a.GetTypes();
ReflectionTypeLoadException gets thrown on the second
line:
System.Reflection.ReflectionTypeLoadException: One or
more of the types in the assembly unable to load.
I'm trying to work out exactly why. If I listen to the
ModuleResolve assembly event as well as the current
AppDomain's AssemblyResolve and TypeResolve events,
nothing fires - I would of expected one of them to. The
exception instance isn't very helpful either, it just
lists the types that *were* loaded, not the one(s) that
caused the problem. I've tried using the binding log
viewer, but it reports nothing, and I've also tried using
the Assembly.LoadFile() method instead of LoadFrom.
The current AppDomain's RelSearchPath and BasePath both
seem to be right (RelSearchPath includes the directory of
the assembly being loaded, and BasePath includes library
assemblies that the loaded assembly requires). No
assemblies (besides the FX) are in the GAC, nor do I want
them to be.
How do I work out what's going wrong here?? Why don't the
Module/Type resolve failure events fire?
I'm trying to load a list of types from a dynamically
loaded assembly, e.g:
Assembly a = Assembly.LoadFrom(path);
a.ModuleResolve += new ModuleResolveEventHandler
(OnAssemblyModuleResolve);
types = a.GetTypes();
ReflectionTypeLoadException gets thrown on the second
line:
System.Reflection.ReflectionTypeLoadException: One or
more of the types in the assembly unable to load.
I'm trying to work out exactly why. If I listen to the
ModuleResolve assembly event as well as the current
AppDomain's AssemblyResolve and TypeResolve events,
nothing fires - I would of expected one of them to. The
exception instance isn't very helpful either, it just
lists the types that *were* loaded, not the one(s) that
caused the problem. I've tried using the binding log
viewer, but it reports nothing, and I've also tried using
the Assembly.LoadFile() method instead of LoadFrom.
The current AppDomain's RelSearchPath and BasePath both
seem to be right (RelSearchPath includes the directory of
the assembly being loaded, and BasePath includes library
assemblies that the loaded assembly requires). No
assemblies (besides the FX) are in the GAC, nor do I want
them to be.
How do I work out what's going wrong here?? Why don't the
Module/Type resolve failure events fire?