开发者

Get types in assembly: ReflectionTypeLoad Exception [duplicate]

开发者 https://www.devze.com 2023-04-04 06:55 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to reproducably cause / provoke a ReflectionTypeLoadException?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to reproducably cause / provoke a ReflectionTypeLoadException?

I wanted to get all types in a loaded assembly.code snippet is as fo开发者_运维百科llows

Assembly assemblyObj = Assembly.LoadFile(@"D:\abc\abc.dll");
            IList<Type> types = assemblyObj.GetTypes();

when i run im getting ReflectionTypeLoadException.What is the mistake in the code.


As you can see in my answer to the question linked as duplicate, the problem most likely is, that "abc.dll" contains a class that derives from a class in a referenced assembly and that referenced assembly doesn't contain that base class, because it has the wrong version.

0

精彩评论

暂无评论...
验证码 换一张
取 消