From VS Feedback for .Net 4.5.2 - https://developercommunity.visualstudio.com/content/problem/539608/net-452-systemruntimecachingmemorycachestatisticss.html
- private readonly MemoryCache messageStore = new MemoryCache("Message Store");
- Thread 1: this.messageStore.Add(messageId, message, new CacheItemPolicy { AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(5), RemovedCallback = arguments => { if (arguments.RemovedReason == CacheEntryRemovedReason.Expired) { // Logging ... } } })
- Timer Thread (System.Threading.Timer):this.messageStore.GetCount();
- Thread 2: this.messageStore.Get
- Thread Pool (TPL): this.messageStore.Remove
System.DivideByZeroException: Es wurde versucht, durch 0 (null) zu teilen. bei System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats(Int64 trimDurationTicks, Int64 totalCountBeforeTrim, Int64 trimCount) bei System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32 minPercent) bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.TimerQueueTimer.CallCallback() bei System.Threading.TimerQueueTimer.Fire() bei System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() bei System.Threading.ThreadPoolWorkQueue.Dispatch()
From VS Feedback for .Net 4.5.2 - https://developercommunity.visualstudio.com/content/problem/539608/net-452-systemruntimecachingmemorycachestatisticss.html
System.DivideByZeroException: Es wurde versucht, durch 0 (null) zu teilen. bei System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats(Int64 trimDurationTicks, Int64 totalCountBeforeTrim, Int64 trimCount) bei System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32 minPercent) bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.TimerQueueTimer.CallCallback() bei System.Threading.TimerQueueTimer.Fire() bei System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() bei System.Threading.ThreadPoolWorkQueue.Dispatch()