ServiceStack: Upgrade to 5.4.1 gives me ReflectionTypeLoadException on ServiceStack.Common

好久不见. 提交于 2019-12-11 10:05:35

问题


I was running ServiceStack 5.2.0, until I upgraded due to this answer.

After doing that, and running the application again, I now get ReflectionTypeLoadException, when processing the Assembly ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587.

In my code, for some reason irrelevant to this question, I do the following:

Type[] typeArray = assembly.GetTypes();

and when I do, I get this error:

{"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"}

I thought "lets avoid processing Servicestack, as its not really what Im after anyway here, so I changed it to:

if (!assembly.DefinedTypes.Any(x => x.FullName.StartsWith("SomeThing")))

but I still get the same error when execution hits this line.

UPDATE

After upgrading, I actually see LoaderExceptions elsewhere too =(

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

Something happened to some underlying library? Hmm.


回答1:


As Mythz said in the comments here, all that was needed to do, was to clear the NuGet cache:

VS --> Tools --> NuGet Packet Manager --> Packet Manager Settings --> Clear All NuGet Caches(s)



来源:https://stackoverflow.com/questions/54850801/servicestack-upgrade-to-5-4-1-gives-me-reflectiontypeloadexception-on-servicest

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!