本文介绍了ServiceStack:升级到 5.4.1 给了我 ServiceStack.Common 上的 ReflectionTypeLoadException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行的是 ServiceStack 5.2.0,直到我升级了

{"来自程序集'ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'的'ServiceStack.SimpleAppSettings'类型的方法'GetKeyValuePairs'没有实现.":"ServiceStack.SimpleAppSettings"}

我认为让我们避免处理 Servicestack,因为它不是我在这里真正追求的,所以我将其更改为:

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

但是当执行到这一行时我仍然得到同样的错误.

更新

升级后,我实际上在其他地方也看到了 LoaderExceptions =(

System.Reflection.ReflectionTypeLoadException:无法加载一个或更多请求的类型.检索 LoaderExceptions 属性想要查询更多的信息.在System.Reflection.RuntimeModule.GetTypes(RuntimeModule 模块)在System.Reflection.RuntimeModule.GetTypes() 在System.Reflection.Assembly.GetTypes() 在tWorks.Core.CoreServerCommons.RequestProcessing.RequestProcessorFactory`2.<>c.b__8_0(组装组装)在....RequestProcessorFactory.cs:line105

某些底层库发生了什么事?嗯.

解决方案

正如 Mythz 在评论中所说 此处,所有需要做的就是清除 NuGet 缓存:

VS -->工具 -->NuGet 数据包管理器 -->数据包管理器设置 -->清除所有 NuGet 缓存

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:

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 =(

Something happened to some underlying library? Hmm.

解决方案

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)

这篇关于ServiceStack:升级到 5.4.1 给了我 ServiceStack.Common 上的 ReflectionTypeLoadException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 19:10