EditCopy() Got Exception Error

I'm got error while trying to copy GoGroup ( GoBox , GoImage) to new node the exception message here -> Why error ? , this node can delete, can move but can't copy! or error came from GoDiagram BUG ???

EditCopy: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.ArrayListEnumeratorSimple.MoveNext()
at NodeEditor.GetDigitsNode.CopyObject(GoCopyDictionary env) in d:\users\suwit\sunproduct\nodeeditor2003\nodeinfo\getdigitsn ode.cs:line 521
at Northwoods.Go.GoCopyDictionary.Copy(GoObject obj)
at Northwoods.Go.GoDocument.CopyFromCollection(IGoCollection coll, Boolean copyableOnly, Boolean dragging, SizeF offset, GoCopyDictionary env)
at Northwoods.Go.GoView.CopyToClipboard(IGoCollection coll)
at Northwoods.Go.GoView.EditCopy()


I don’t know–clearly the error is saying that you are trying to modify a collection while you are iterating over it, in GetDigitsNode.CopyObject. You’ll need to examine your code carefully and debug it. Perhaps you are adding things to the original collection that you are copying, instead of to the new collection.


Here’s my snippet code that cause of exception, please advise.
public override GoObject CopyObject(GoCopyDictionary env)
// GetDigitsNode newobj = (GetDigitsNode) base.CopyObject(env); GetDigitsNode newobj = base.CopyObject(env) as GetDigitsNode;

if (newobj != null)
if (newobj.Cases.Count<=0)
newobj.Cases = new CaseEventCollection(); //(CaseEventCollection)env[m_CaseEventCollection];
foreach(CaseEvent ca in this.Cases)
if (newobj.VariableToReceiveResult.Count<=0)
newobj.VariableToReceiveResult = new MyVariableCollection();
foreach(VariableList v in this.VariableToReceiveResult)
catch{ }
newobj.UserObject = new GetDigitsNodeInfo(newobj);
return newobj;


You’re not sharing the collection of cases, but did you want to share each CaseEvent? And the same question for VariableLists.
I’m sorry, but I can’t really understand your code.


the purpose is i want to copy my owner infomation in field “.UserObject” (which contained 2 collections object “Cases” and VariableList) ,
Because when i copy myGoObject to new location the information in node( userobject ) not copied. only main node copied to new location that why i need to manually add with :
newobj.UserObject = new GetDigitsNodeInfo(newobj);

Any idea, please help