【发布时间】:2019-04-24 10:20:31
【问题描述】:
在 C# 中,当尝试获取类型时,使用下面的代码从文件夹中加载 DLL 获取这些堆栈跟踪。
var assembly = Assembly.LoadFile(assemblyInfo.FullName); // assembly loads perfectly using the absolute path.
var types = assembly.GetTypes(); // this line throws the below stacktrace.
堆栈跟踪:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
我还检查了现有的解决方案:Error message 'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'、Loading DLLs at runtime in C#(没用)
【问题讨论】:
标签: c# dll dllimport dll-injection dynamic-dll-import