ServiceStack:升级到 5.4.1 在 ServiceStack.Common 上给我 ReflectionTypeLoadException
ServiceStack: Upgrade to 5.4.1 gives me ReflectionTypeLoadException on ServiceStack.Common
我是 运行 ServiceStack 5.2.0,直到我升级 。
完成之后,再次 运行 应用程序,我现在在处理程序集 ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587
时得到 ReflectionTypeLoadException
。
在我的代码中,由于某些与这个问题无关的原因,我做了以下事情:
Type[] typeArray = assembly.GetTypes();
当我这样做时,我得到这个错误:
{"Method 'GetKeyValuePairs' in type 'ServiceStack.SimpleAppSettings' from assembly 'ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587' does not have an implementation.":"ServiceStack.SimpleAppSettings"}
我想“让我们避免处理 Servicestack,因为它并不是我真正想要的”,所以我将其更改为:
if (!assembly.DefinedTypes.Any(x => x.FullName.StartsWith("SomeThing")))
但是当执行到这一行时我仍然得到同样的错误。
更新
升级后,我实际上也在其他地方看到了 LoaderExceptions:
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.RuntimeModule.GetTypes() at
System.Reflection.Assembly.GetTypes() at
tWorks.Core.CoreServerCommons.RequestProcessing.RequestProcessorFactory`2.<>c.b__8_0(Assembly
assembly) in
....RequestProcessorFactory.cs:line
105
某个底层库发生了什么事吗?
正如 Mythz 在评论中所说 ,所有需要做的就是清除 NuGet 缓存:
VS --> Tools --> NuGet Packet Manager --> Packet Manager Settings --> Clear All NuGet Caches(s)
我是 运行 ServiceStack 5.2.0,直到我升级
完成之后,再次 运行 应用程序,我现在在处理程序集 ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587
时得到 ReflectionTypeLoadException
。
在我的代码中,由于某些与这个问题无关的原因,我做了以下事情:
Type[] typeArray = assembly.GetTypes();
当我这样做时,我得到这个错误:
{"Method 'GetKeyValuePairs' in type 'ServiceStack.SimpleAppSettings' from assembly 'ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587' does not have an implementation.":"ServiceStack.SimpleAppSettings"}
我想“让我们避免处理 Servicestack,因为它并不是我真正想要的”,所以我将其更改为:
if (!assembly.DefinedTypes.Any(x => x.FullName.StartsWith("SomeThing")))
但是当执行到这一行时我仍然得到同样的错误。
更新
升级后,我实际上也在其他地方看到了 LoaderExceptions:
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.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at tWorks.Core.CoreServerCommons.RequestProcessing.RequestProcessorFactory`2.<>c.b__8_0(Assembly assembly) in ....RequestProcessorFactory.cs:line 105
某个底层库发生了什么事吗?
正如 Mythz 在评论中所说
VS --> Tools --> NuGet Packet Manager --> Packet Manager Settings --> Clear All NuGet Caches(s)