MichaCo / CacheManager

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
http://cachemanager.michaco.net
Apache License 2.0
2.33k stars 458 forks source link

GetCasted Exception ,I cannot solve it ! #277

Closed Rabbit021 closed 5 years ago

Rabbit021 commented 5 years ago

GetCasted Exception ,I cannot solve it !

Exception:[A]System.Collections.Generic.List1[DataPlamtformCommon.Models.Floor] cannot be cast to [B]System.Collections.Generic.List1[DataPlamtformCommon.Models.Floor]. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.11\System.Private.CoreLib.dll'. Type B originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.11\System.Private.CoreLib.dll'. StackTrace: at CacheManager.Core.Internal.BaseCache1.GetCasted[TOut](Object value) at ServiceCore.Extensions.CacheManagerExt.GetFromCache[T](ICacheManager1 basicCache, String key) in E:\Develop\GeneralCloudPlatform\ServiceCore\Extensions\CacheManagerExt.cs:line 118

Rabbit021 commented 5 years ago

I use it in asp.net core 2.0!

it trow exception when I use redis cache ,but i use dictionarycache it is ok!

MichaCo commented 5 years ago

The error might be misleading, looks more like a de-serialization issue with your Floor object. Could you do a simple Get, that might give a better idea.