Banderson
(Brandon Anderson)
1
So I am getting this error and I don’t know what it means. I’m working in engineering workbench. Can someone give me a clue?
Application Error
Exception caught in: System.Core
Error Detail
============
Message: Collection was modified; enumeration operation may not execute.
Program: System.Core.dll
Method: MoveNext
Client Stack Trace
==================
at System.Collections.Generic.HashSet`1.Enumerator.MoveNext()
at Erp.UI.App.EngWorkBenchEntry.Transaction.refreshExpandedNodes()
at Erp.UI.App.EngWorkBenchEntry.Transaction.Update()
Means you are enumerating a collection, like foreach, but you are modifying that collection, which affects the enumeration.
Simple examples might be adding to or removing from said collection.
(i see in the stack a call to refresh - that probably affects your collection)
Banderson
(Brandon Anderson)
3
I don’t have hardly any code in here. Just a couple things to trigger a save so some BPM’s can run.
Anyways, I closed and re-opened engineering workbench and the problem seems to have gone away. Nagging things like that are annoying.
// **************************************************
// Custom code for EngWorkBenchEntryForm
// Created: 4/19/2017 12:33:55 PM
// **************************************************
extern alias Erp_Contracts_BO_EngWorkBench;
extern alias Erp_Contracts_BO_ECORevSearch;
extern alias Erp_Contracts_BO_BomSearch;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_PartRevSearch;
extern alias Erp_Contracts_BO_Customer;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.ECOMtl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.ECOMtl_AfterFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.ECOMtl_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.ECOMtl_AfterFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void ECOMtl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "QtyPer":
oTrans.Update();
break;
case "RelatedOperation":
oTrans.Update();
break;
}
}
}