Luc*_*uca 7 c# reflection typeloadexception
我正在使用Assembly.GetTypes()来获取插件库中定义的所有类型(因此我可以实例化插件实例).
在特定的库上,该方法引发ReflectionTypeLoadException,说:
Type <Type> is attempting to implement an inaccessible interface
Run Code Online (Sandbox Code Playgroud)
谷歌搜索它似乎是因为特定的类型实现了非公共接口.实际上它是,但Type嵌套在另一个公共类中,声明为private.
如何避免这种例外?
....
制作界面公共代码工作.是否有可能定义这种奇怪的行为是一个bug(在Assembly.GetTypes()中)?这意味着库类型无法实现受保护的交互式界面!