Developer forum

Forum » Integration » Live integration errors i DW10

Live integration errors i DW10

Anders Ebdrup
Reply

Dear DynamicWeb,

 

We have an ecommerce solution integrated with Microsoft Dynamics with the standard LiveIntegration plugin, where we see some issues - please see this list:

2025-04-15 09:47:37.3884: The notification subscriber threw an unexpected error. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at Dynamicweb.Ecommerce.Orders.OrderLineRepository.Save(String orderId, IEnumerable`1 orderLines)
   at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.OrderLineHandlerInternal(Order cart, User user, OrderContext orderContext, OrderLine line, Double quantity, OrderLineQuantityMethod method, Boolean skipSave)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.OrderLineHandler(Order cart, User user, OrderContext orderContext, Double quantity, OrderLine line, OrderLineQuantityMethod method)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.UpdateOrderLines(Order cart, User user, OrderContext orderContext, Boolean allowUpdatingContextCart, Boolean allowEditingCartPrices)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartHandler.CatchCart(PageView pageView)
   at Dynamicweb.Ecommerce.Frontend.EcomPageLoadNotificationSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)

2025-04-15 09:47:37.7695: Unexpected exception GetContent() with the message: Collection was modified; enumeration operation may not execute.. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.XmlGenerators.OrderXmlGenerator.BuildOrderLinesXml(Settings currentSettings, XmlDocument xmlDocument, Order order, OrderXmlGeneratorSettings settings, Logger logger)
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.XmlGenerators.OrderXmlGenerator.GenerateOrderXml(Settings currentSettings, Order order, OrderXmlGeneratorSettings settings, Logger logger)
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.OrderHandler.UpdateOrder(Settings settings, Order order, SubmitType liveIntegrationSubmitType, String successOrderStateId, String failedOrderStateId)
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Orders.LiveCartCalculationProvider.CalculateCart(Order cart)
   at Dynamicweb.Ecommerce.Cart.CartCalculationManager.CalculateCart(Order cart)
   at Dynamicweb.Ecommerce.Cart.Frontend.GetModuleContent()
   
2025-04-15 09:47:36.2628: Error executing razor template (Designs/Swift-v2/Swift-v2_CartSummary.cshtml) https://www.xxx.dev/Default.aspx?ID=1291&CartType=minicart&RequestPageID=1840&OrderContext=null&LayoutTemplate=Swift-v2_CartSummary.cshtml. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewModelFactory.CreateCartViewModel(Order cart, Nullable`1 areaId)
   at Dynamicweb.Ecommerce.Frontend.EcomPageOnOutputSubscriber.CreateInstance(Order cart, Nullable`1 areaId, Boolean handleTaxesAndDiscounts)
   at Dynamicweb.Ecommerce.Frontend.EcomPageOnOutputSubscriber.<>c__DisplayClass0_0.<OnNotify>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_75bf097966a742958ea77ce38333a211.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

As a sidenote we do not have any other modification to the integration than this:

    [Subscribe(Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications.Order.OnAfterGenerateOrderXml)]
    public class OnAfterGenerateOrderXmlNotificationSubscriber : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var myArgs = (Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications.Order.OnAfterGenerateOrderXmlArgs)args;

            ClearOrderCurrencyCode(myArgs.Document);
        }

        static void ClearOrderCurrencyCode(XmlDocument doc)
        {
            XmlNode currencyNode = doc.SelectSingleNode("//column[@columnName='OrderCurrencyCode']");

            //TODO: Move to setting
            if (currencyNode != null && currencyNode.InnerText == "DKK")
            {
                currencyNode.InnerText = string.Empty;
            }
        }
    }

 

Best regards, Anders


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Anders,
this is now fixed in the new Live integration 10.4.21.
BR, Dmitrij

Votes for this answer: 1

 

You must be logged in to post in the forum