[英]System.PlatformNotSupportedException exception when calling Assembly.ReflectionOnlyLoadFrom
我正在使用.NET Core 2.1加载调用Assembly.ReflectionOnlyLoadFrom(...)
的程序集,但遇到了System.PlatformNotSupportedException
异常。 Microsoft文档似乎表明它应该可以工作。 实施了吗? 如果没有,是否有其他选择可以使用.NET Core从.NET 4.7.2程序集获取导出的类型?
Assembly.ReflectionOnlyLoadFrom(fileName) 'Assembly.ReflectionOnlyLoadFrom(fileName)' threw an exception of type 'System.PlatformNotSupportedException' Data: {System.Collections.ListDictionaryInternal} HResult: -2146233031 HelpLink: null InnerException: null Message: "ReflectionOnly loading is not supported on this platform." Source: "System.Private.CoreLib" StackTrace: " at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)" TargetSite: {System.Reflection.Assembly ReflectionOnlyLoadFrom(System.String)}
如上所述,.net内核尚不支持反射。 您可以从LAB的存储库中使用实验用TypeLoader 。
如果你想使用实验NuGets,你需要遵循指示: https://github.com/dotnet/corefxlab (基本上添加的NuGet回购- https://dotnet.myget.org/F/dotnet-corefxlab/ )并获取System.Reflection.TypeLoader。
不过不要期望太多的支持:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.