November Happy Hour will be moved to Thursday December 5th.

Exception while trying to edit the shipping address

Vote:
 

After creating a purchase order, I go to the Commerce Manager ("Order Management" -> "Purchase Orders" -> "Today" -> My created order -> "Details" -> "Edit shipping address") and try to edit the shipping address, adding an email. But when I try to save changes, I get an error:

2019-01-17 14:56:52,729 [135] 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)

I looked into the code and found a method in which an error occurs. But I do not understand how it arises here:

private static void CopyPropertiesFrom(IExtendedProperties target, IExtendedProperties source, bool overwrite)
{
  Validator.ThrowIfNull(nameof (target), (object) target);
  Validator.ThrowIfNull(nameof (source), (object) source);
  if (target.Properties == null)
    throw new InvalidOperationException("The Properties property of the target parameter can not be null.");
  if (source.Properties == null)
    return;
  foreach (object key in (IEnumerable) source.Properties.Keys)
  {
    if (overwrite || !target.Properties.ContainsKey(key))
      target.Properties[key] = source.Properties[key];
  }
}

Can anyone explain why an error occurs?

By the way, the interface itself does not show that an error has occurred. I accidentally found out about it, looking into the browser's developer tools. When I press the save button in the modal address editing window, the window closes and nothing happens. When I refresh the page, the message "The Order is in Edit Mode. Save changes before exiting" appears. When I open the address editing window again, all the fields are empty, not filled with data that was before.

#200607
Edited, Jan 17, 2019 13:16
Vote:
 

I could not reproduce the problem. Is it persistent, or just one time? 

#200612
Jan 17, 2019 13:50
Vote:
 

For me its persistent, reproduced for each order.

#200615
Jan 17, 2019 13:59
Vote:
 

Then I'd suggest you to contact our developer support to provide an environment to produce and we'll be happy to look into it 

#200617
Jan 17, 2019 14:03
Vote:
 

Okay, thanks

#200618
Jan 17, 2019 14:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.