.NET Framework 4.7: Caches using absolute expiration might expire earlier or later than expected (9.x)

Found in

EPiServer.CMS.Core 7.0.586.0

Fixed in

EPiServer.CMS.Core 9.12.5

Created

Aug 14, 2017

Updated

Oct 19, 2018

Area

CMS Core

State

Closed, Fixed and tested


Description

The built-in cache manager in Episerver uses DateTime.Now (rather than DateTime.UtcNow), because of a bug in .NET Framwork this is no longer supported and the local time will be treated as an UTC time instead. ISynschronizedObjectInstanceCache is with this fix changed to use DateTime.UtcNow to avoid this bug in .NET (per recommendation in MSDN https://msdn.microsoft.com/en-us/library/4y13wyk9(v=vs.110).aspx).

Bug in .NET Framework 4.7: https://support.microsoft.com/en-us/help/4035412/fix-expiration-time-issue-when-you-insert-items-by-using-the-cache-ins
Workaround: Apply .NET Framework 4.7.1 (not released yet as of writing this): https://github.com/Microsoft/dotnet/blob/master/releases/net471/dotnet471-changes.md