Hi there,
I have a site running 9.18.0 that is regularly failing on getting a currency from the cache. When it fails, I see the following stack trace:
System.ArgumentNullException: Value cannot be null. Parameter name: key at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value) at Dynamicweb.Caching.DictionaryCache`2.GetCacheResult(IEnumerable`1 keys) at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) at Dynamicweb.Ecommerce.ProductCatalog.ViewSettingsBaseCurrencyBase`1.GetCurrency() at Dynamicweb.Ecommerce.ProductCatalog.ViewSettingsBaseCurrencyBase`1.GetPriceContext() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__49() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at CompiledRazorTemplates.Dynamic.RazorEngine_54bb315f40d545b283e52306beddefc3.Execute()
What it looks like is that it's failing because the code tries to look up a currency by a null-code; i.e. the requested cache key is null rather than the returned item .
It could be custom code maybe but we're seeing the same thing in the backend too. When it happens, opening the Orders list under Ecommerce gives me this:
[ArgumentNullException: Value cannot be null. Parameter name: key] System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value) +14397390 Dynamicweb.Caching.DictionaryCache`2.GetCacheResult(IEnumerable`1 keys) +347 Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) +143 Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) +104 Dynamicweb.Ecommerce.Orders.Order.get_Currency() +49 Dynamicweb.Ecommerce.Orders.OrderLineService.GetByOrder(Order order) +286 Dynamicweb.Ecommerce.Orders.Order.get_OrderLines() +155 Dynamicweb.Admin.UCOrderList.GetListRow(OrderSearchResultItem backendOrder, Int32 index) +2114 Dynamicweb.Admin.UCOrderList.FillList() +497 Dynamicweb.Admin.UCOrderList.LoadList() +848
All orders in the database have a valid currency code and none of them is null. What's even more confusing is that the problem seems to solve itself. The problem goes away by itself, only to return again a bit later.
Could it be related to import jobs that may be clearing the cache? Is there anything I can look at or debug to further troubleshoot this?
Imar