Try our conversational search powered by Generative AI!
AI OnAI Off
May 13, 2019
Jun 07, 2019
Closed, Fixed and tested
Partner gets an exception which possibly seems to happen when CartProvider.Delete tries to delete a cart that is already deleted.
System.NullReferenceException: Object reference not set to an instance of an object. at EPiServer.Commerce.Order.Internal.CartProvider.Delete(OrderReference orderLink) at EPiServer.Commerce.Order.DefaultOrderRepository.Delete(OrderReference orderLink) at EPiServer.Commerce.Order.Internal.CartMigrator.MigrateCarts(Guid sourceCustomerId, Guid destinationCustomerId) at EPiServer.Commerce.Order.ProfileMigrator.MigrateCarts(Guid anonymousId) at EPiServer.Business.Commerce.HttpModules.ProfileModule.Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs pe) at System.Web.Profile.ProfileModule.OnEnter(Object source, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
They think that it might happen when two requests initiating cart migration at the same time. They think we should implement a null check on
public void Delete(OrderReference orderLink) { Cart cart = CartProvider.EnsureCartType(this.Load(orderLink.OrderGroupId)); cart.Delete(); cart.AcceptChanges(); }