It should not be a problem here. The code to load the contact will simply return null if the contact is not found. But yes I think this can be improved - we will look into it.
Just a follow up: We did improve it, and our testing shows an improvement of 25% on the validation of a cart with 3 items.
It'll be available in an upcoming release (probably 11.4)
Just as follow up : I am using 11.5
And the not found exceptions keep spamming the log! I am getting more than 14000 of this type of errors per hour! Please make it stop. Now for some trace:
CartService.LoadOrCreateCart
ERROR Object Contact.PrimaryKeyId = '80509e35-60b3-478e-b403-3a12247e7a23' not found Mediachase.BusinessFoundation.Data.Meta.ObjectNotFoundException: Object Contact.PrimaryKeyId = '80509e35-60b3-478e-b403-3a12247e7a23' not found at Mediachase.BusinessFoundation.Data.Meta.MetaObject.GetRowSource at Mediachase.BusinessFoundation.Data.Meta.MetaObject.Load at Mediachase.BusinessFoundation.Data.Meta.MetaObject..ctor at Mediachase.BusinessFoundation.Data.Meta.MetaObject..ctor at Mediachase.BusinessFoundation.Data.Meta.MetaObjectActivator.CreateInstance at Mediachase.BusinessFoundation.Data.Meta.MetaObjectActivator.CreateInstance at Mediachase.BusinessFoundation.Data.Meta.MetaObjectActivator.CreateInstance at Mediachase.BusinessFoundation.Data.Business.EntityObjectDefaultRequestHandler.Load at Mediachase.BusinessFoundation.Data.Business.EntityObjectDefaultRequestHandler.Execute at Mediachase.BusinessFoundation.Data.Business.BaseRequestHandler.Mediachase.BusinessFoundation.Data.Business.IRequestHandler.Execute at Mediachase.BusinessFoundation.Data.Business.BusinessManager.ExecutePipeline at Mediachase.BusinessFoundation.Data.Business.BusinessManager.Execute at Mediachase.BusinessFoundation.Data.Business.BusinessManager.Load
The improvement made in 11.4 should have reduced it, but I think we can make further improvement. I will look into this
Cool! It would be nice if the absence of a contact (not found) just would return an empty contact without throwing the exception.
What I don't understand is BusinessManager.Load actually catches the exception and return null (yes, not the perfect way to do it), how could that end up in your log files ...
It does not end up in our SEQ logger where we log to in our code but somehow the mediachase part of the application writes to the IIS log that stackify picks up on. Here is just 5 seconds of log ===>>>
When I look into it, the pipepline is actually too complicated to make a meaningful fix. I know that is not something you would like to hear, but, there are legacy parts that should be left as-is.
You can configure stackify to reduce the log, I guess:
Ok, I configured stackify to only log unhandled exceptions. We will wait and see what will happen.
Hi!
We are running Commerce 11.2.2 and are still using workflows. We just found out that exceptions are caught when we run the CartValidate workflow.
Our code:
Running this code gives us this exception:
Removing this line of code:
Which runs the CartValidate workflow, and the exception goes away so I guess there is something in the workflow.
The web works just fine, but I'm nort sure if this affects the perfrormance in any way?
/Kristoffer