获取程序集中的类型:ReflectionTypeLoad 异常
我想获取所有内容加载的程序集中的类型。当我运行时收到 ReflectionTypeLoadException 时,代码片段如下。
Assembly assemblyObj = Assembly.LoadFile(@"D:\abc\abc.dll");
IList<Type> types = assemblyObj.GetTypes();
代码中的错误是什么。
Possible Duplicate:
How to reproducably cause / provoke a ReflectionTypeLoadException?
I wanted to get all types in a loaded assembly.code snippet is as follows
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您在我对重复链接的问题的回答中看到的,最有可能的问题是“abc.dll”包含一个派生自引用程序集中的类的类,并且该引用程序集不包含该基类,因为它的版本错误。
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.