Conflict between cache keys in DefaultContentVersionRepository

Fixed in

EPiServer.CMS.Core 11.15.0

Created

Feb 28, 2020

Updated

Mar 23, 2020

Area

CMS Core

State

Closed, Fixed and tested


Description

The following stack trace can be seen in error logs:

System.InvalidOperationException: Unknown object of type System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 found with cache key EP:ContentVersion:11873. Expected type EPiServer.DataAbstraction.Internal.DefaultContentVersionRepository+CachedVersionList, EPiServer, Version=11.13.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7

The reason is that DefaultContentVersionRepository stores two kinds of objects in the cache. And, one of them can get a cachekey that matches the other kind. This results in a conflict and the raising of an InvalidOperationException.

The solution: ensure that different types of cached items have different types of cache keys.