November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Before proceeding try to call following method:
var node = CatalogNodeManager.GetCatalogNodeDto(code, new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeInfo));
And then check count of nodes loaded:
var count = node.CatalogNode.Count;
If count will be zero - EPiServer anyway wil try to insert `null` in cache which is guarded by .Net Framework.
Does catalog by that code exists in Commerce?
Yes, this problem occurs on catalog nodes that does not exist.
Yes, this approach works for catalog nodes that does not exist:
var node = CatalogContext.Current.GetCatalogNodeDto(code, new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeInfo));
But that does not change fact that this method does not work:
var node = CatalogContext.Current.GetCatalogNode(code, new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeInfo));
GetCatalogNode method has bug in it and it should return null if catalogNode is not found and not throw exception:
System.ArgumentNullException: Value cannot be null.
Hi,
Yes, that sounds like a bug. I will file a bug report to see what we can do to improve the situation.
Thank you for bringing this to our attention.
Regards.
/Q
Just upgraded other project to 7.6.0 and got exactly the same error, decided to check out 7.9.0 and there is no error anymore, its fixed somewere between 7.6.0 and 7.9.0
Sometimes one needs to determine if particular catalog node code is used in previous versions of Commerce we used to call following method to verify, if it does exist, if not - null was returned.
However now in Commerce 7.5(7.6.1), if it does not exist(value is null), it tries to cache it anyway and fails with following exception:
How then I'm supposed to check for existence by catching exception if I already know catalog node code?
Also this method is not marked as deprecated so it should work as expected and not throw exception.