Try our conversational search powered by Generative AI!

Exception when updating shipping address if address has metafields

Found in

EPiServer.Commerce 12.0.0

Fixed in

EPiServer.Commerce 13.0.0

(Or a related package)

Created

Feb 18, 2019

Updated

Mar 29, 2019

Area

Core

State

Closed, Fixed and tested


Description

Steps to reproduce:

  1. Add one or more metafields to the OrderAddress Extended metaclass.
  2. Go to Commerce Manager.
  3. Try to update a shipment's shipping address.

Expected:
Update successfully.

Actual:
Address is not updated. This error is thrown in browser console.

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Collection was modified; enumeration operation may not execute.
    at Function.Error$create [as create] (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.debug.js:237:15)
    at Sys$WebForms$PageRequestManager$_createPageRequestManagerServerError [as _createPageRequestManagerServerError] (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjaxWebForms.debug.js:656:23)
    at Sys$WebForms$PageRequestManager$_parseDelta [as _parseDelta] (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjaxWebForms.debug.js:1534:44)
    at Sys$WebForms$PageRequestManager$_onFormSubmitCompleted [as _onFormSubmitCompleted] (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjaxWebForms.debug.js:1314:25)
    at Array.<anonymous> (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.debug.js:47:23)
    at http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.debug.js:3484:23
    at Sys$Net$WebRequest$completed [as completed] (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.debug.js:6376:13)
    at XMLHttpRequest.<anonymous> (http://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.debug.js:5996:35)
Error$create @ MicrosoftAjax.debug.js:237
Sys$WebForms$PageRequestManager$_createPageRequestManagerServerError @ MicrosoftAjaxWebForms.debug.js:656
Sys$WebForms$PageRequestManager$_parseDelta @ MicrosoftAjaxWebForms.debug.js:1534
Sys$WebForms$PageRequestManager$_onFormSubmitCompleted @ MicrosoftAjaxWebForms.debug.js:1314
(anonymous) @ MicrosoftAjax.debug.js:47
(anonymous) @ MicrosoftAjax.debug.js:3484
Sys$Net$WebRequest$completed @ MicrosoftAjax.debug.js:6376
(anonymous) @ MicrosoftAjax.debug.js:5996
XMLHttpRequest.send (async)
(anonymous) @ VM5939:1
Sys$Net$XMLHttpExecutor$executeRequest @ MicrosoftAjax.debug.js:6076
Sys$Net$_WebRequestManager$executeRequest @ MicrosoftAjax.debug.js:6302
Sys$Net$WebRequest$invoke @ MicrosoftAjax.debug.js:6481
Sys$WebForms$PageRequestManager$_onFormSubmit @ MicrosoftAjaxWebForms.debug.js:1292
Sys$WebForms$PageRequestManager$_doPostBack @ MicrosoftAjaxWebForms.debug.js:824
(anonymous) @ MicrosoftAjax.debug.js:47
McCommandHandlerRefreshWindow @ ContentFrame.aspx?_a=Order&_v=PurchaseOrder-ObjectView&id=1000&customerid=8c65098b-67d2-436d-bbe1-d01d50f14a3d:1828
(anonymous) @ DialogPage.aspx?_a=Order&_v=OrderAddress-Edit&Id=1000&OrderGroupAddressId=1000&ShipmentId=1000&CommandName=cmdShipmentAddressEdit_Rebind&IsShippingAddress=true&refreshName=McCommandHandlerRefreshWindow&closeFramePopup=McCommandHandler_ClosePopup&dependRefreshCommand=cmdShipmentAddressEdit_Rebind:729

This error can be found in log

2019-02-07 15:53:41,794 [310] ERROR EPiServer.Global: Unhandled exception in ASP.NET
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Hashtable.HashtableEnumerator.MoveNext()
at Mediachase.Commerce.Extensions.IExtendedPropertiesExtensions.CopyPropertiesFrom(IExtendedProperties target, IExtendedProperties source, Boolean overwrite)
at Mediachase.Commerce.Orders.OrderForm.UpdateOrderAddress(OrderAddress address, IOrderAddress orderAddress)
at Mediachase.Commerce.Orders.Shipment.SetShippingAddress(IOrderAddress value)
at Mediachase.Commerce.Orders.Shipment.EPiServer.Commerce.Order.IShipment.set_ShippingAddress(IOrderAddress value)
at Mediachase.Commerce.Manager.Order.CommandHandlers.PurchaseOrderHandlers.EditShipmentAddressHandler.EditShipmentAddress(IOrderGroup order, CommandParameters cp)
at Mediachase.BusinessFoundation.CommandHandler.PostBackHandler(Object Sender, Object Command, Object Argument)
at Mediachase.BusinessFoundation.CommandManager.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.apps_shell_pages_contentframe_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)