1

Closed

Error when batch delete products

description

This error happens with version 2.7

Server Error in '/' Application.

Collection was modified; enumeration operation may not execute.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

Source Error:


Line 162: {
Line 163: var productTags = product.ProductTags;
Line 164: foreach (var productTag in productTags)
Line 165: _productTagService.UpdateProductTagTotals(productTag);
Line 166: }

Source File: d:\Work\www.koloeyewear.ca\Presentation\Nop.Web\Administration\Controllers\ProductController.cs Line: 164

Stack Trace:


[InvalidOperationException: Collection was modified; enumeration operation may not execute.]
System.Collections.Generic.Enumerator.MoveNext() +13959784
Nop.Admin.Controllers.ProductController.UpdateProductTagTotals(Product product) in d:\Work\www.koloeyewear.ca\Presentation\Nop.Web\Administration\Controllers\ProductController.cs:164
Nop.Admin.Controllers.ProductController.DeleteSelected(String selectedIds) in d:\Work\www.koloeyewear.ca\Presentation\Nop.Web\Administration\Controllers\ProductController.cs:787
lambda_method(Closure , ControllerBase , Object[] ) +127
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +274
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +39
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +120
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +452
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +452
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +33
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +240
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Closed Nov 5, 2013 at 12:32 PM by AndreyMaz
Fixed in the latest versions (logic changed)

comments