Hey all,
I'm having some issues retrieving the Type information of a .dll, using Reflection. To give some background, I need to dynamically call particular functions within a .dll from a seperate class. This is a code snippet that I'm using right now:
Type[] types = assembly.GetTypes(); string ClassName = types[0].FullName;Instance = assembly.CreateInstance(types[0].FullName);
This worked just fine, but then I changed the .dll class from this:
class
Test {to
class
Test : BasicEngineWrapper.EngineUtilities, BasicEngineWrapper.IEngineWrapperBasicEngineWrapper.Engine.Utilities is an Abstract Class and BasicEngineWrapper.IEngineWrapper is an interface.
I get an error at: "Type[] types = assembly.GetTypes()", it reads "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information".
I've been trying to fix this for quite a while, although I'm not to familiar using Reflection. Mabye I'm not using these methods correctly, any help would be much appreciated.
Tony

Bechir BejaouiRank #144 · 15.9K reputationPosted Jul 30, 2008, 1:30 PM EDT
Bechir BejaouiRank #144 · 15.9K reputationPosted Jul 30, 2008, 1:30 PM EDT
Tony Castro9 reputationPosted Jul 30, 2008, 2:29 PM EDT
AlanRank #669 · 3.6K reputationPosted Jul 30, 2008, 3:17 PM EDT
Bechir's point is that the Assembly.GetTypes() method won't be able to load a type which depends on other types contained in another assembly unless that assembly is loaded as well.
So, you'll need to load the assembly containing the types BasicEngineWrapper.EngineUtilities and BasicEngineWrapper.IEngineWrapper first.
A read through the documentation for the GetTypes() method may make the point a bit clearer:
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettypes.aspx
Tony Castro9 reputationPosted Jul 30, 2008, 4:44 PM EDT