【问题标题】:Get types in assembly: ReflectionTypeLoad Exception [duplicate]获取程序集中的类型:ReflectionTypeLoad Exception [重复]
【发布时间】:2011-09-13 10:03:48
【问题描述】:

可能重复:
How to reproducably cause / provoke a ReflectionTypeLoadException?

我想在加载的程序集中获取所有类型。代码sn-p如下

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

当我运行时,我得到 ReflectionTypeLoadException。代码中的错误是什么。

【问题讨论】:

    标签: reflection c#-4.0 assembly.reflectiononly


    【解决方案1】:

    正如您在我对链接为重复的问题的回答中看到的那样,问题很可能是,“abc.dll”包含一个派生自引用程序集中的类的类,而引用的程序集不包含该类基类,因为它有错误的版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多