FIX: "System.Runtime.Caching.MemoryCache" class does not work as expected when a .NET Framework 4.0-based web server experiences memory pressure


Assume that update 2828843 or 2836939 for the .NET Framework 4.0 (or both) are installed on a web server. The web server hosts a web application that uses the System.Runtime.Caching.MemoryCache class to manage the cache on the web server. When the server experiences memory pressure, the System.Runtime.Caching.MemoryCache class does not work as expected. More specifically, existing cache items are lost, and you cannot add new items to the cache. Additionally, the following call stack information is displayed in a debugger:

Exception Message: Type 'System.Threading.ExecutionContext' does not have a public property named 'PreAllocatedDefault' System_Web_ni!System.Web.Util.ExecutionContextUtil.GetDummyDefaultEC() System_Web_ni!System.Web.Util.ExecutionContextUtil..cctor() System_Web_ni!System.Web.Util.ExecutionContextUtil.RunInNullExecutionContext(System.Action)+0x33 System_Web_ni!System.Web.Hosting.ObjectCacheHost.System.Runtime.Caching.Hosting.IMemoryCacheManager.UpdateCacheSize (Int64, System.Runtime.Caching.MemoryCache)+0x1cc System_Runtime_Caching_ni!System.Runtime.Caching.CacheMemoryMonitor.GetCurrentPressure()+0xf5 System_Runtime_Caching_ni!System.Runtime.Caching.MemoryMonitor.Update()+0x15 System_Runtime_Caching_ni!System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32)+0x69 mscorlib_ni!System.Threading.ExecutionContext.runTryCode(System.Object)+0x178 mscorlib_ni!System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)+0x1 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0xa1 mscorlib_ni!System.Threading._TimerCallback.PerformTimerCallback(System.Object)+0x97 


After you install updates 2828843 and 2836939, a function in the ASP.NET cache management calls some code that does not exist in the .NET Framework 4.0. Therefore, the following hotfix changes the code in the .NET Framework 4.0.

This hotfix is available for the following operating systems:   
  • Windows XP Service Pack 3 (SP3)
  • Windows Server 2003 Service Pack 2 (SP2)
  • Windows Vista Service Pack 2 (SP2)
  • Windows Server 2008 Service Pack 2 (SP2)
  • Windows 7 Service Pack 1 (SP1)
  • Windows Server 2008 R2 Service Pack 1 (SP1)

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.


To apply this hotfix, you must have the .NET Framework 4.0 installed.

Restart requirement

You do not have to restart the computer after you apply this hotfix if you are not using the files that are affected by this hotfix.

We recommend that you close all .NET Framework applications before you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.
File information


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Article ID: 2888303 - Last Review: Dec 11, 2013 - Revision: 1

Microsoft .NET Framework 4