You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem with using that method is that it whitelists object types that it supports, it is not a general serialization method:
public static void Serialize(Stream stream, object data)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
switch (data)
{
case OutputCacheEntry _:
case PartialCachingCacheEntry _:
case CachedVary _:
case ControlCachedVary _:
case FileResponseElement _:
case MemoryResponseElement _:
case SubstitutionResponseElement _:
binaryFormatter.Serialize(stream, data);
break;
default:
throw new ArgumentException(System.Web.SR.GetString("OutputCacheExtensibility_CantSerializeDeserializeType"));
}
}
System.Web.Caching.CachedVary is in the allowed list, but Microsoft.AspNet.OutputCache.CachedVary is not (since it's not a dependency).
This means that RedisOutputCacheProvider does not work with Microsoft.AspNet.OutputCache.OutputCacheModuleAsync, which seems like a common use case.
Switching back to internal serialization would fix this issue.
The text was updated successfully, but these errors were encountered:
We recently updated from version 3.0.1 to version 4.0.1 and output caching broke silently.
After investigating, the issue seems to be in serialization. 3.0.1 used this for serialization:
redisUtility.GetBytesFromObject(entry)
, which used a custom orBinarySerializer
.In 4.0,1 the code switched to:
System.Web.OutputCache.Serialize(ms, outputCacheEntry);
The problem with using that method is that it whitelists object types that it supports, it is not a general serialization method:
System.Web.Caching.CachedVary
is in the allowed list, butMicrosoft.AspNet.OutputCache.CachedVary
is not (since it's not a dependency).This means that RedisOutputCacheProvider does not work with Microsoft.AspNet.OutputCache.OutputCacheModuleAsync, which seems like a common use case.
Switching back to internal serialization would fix this issue.
The text was updated successfully, but these errors were encountered: