New Posts New Posts RSS Feed: Collection modified error
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Collection modified error

 Post Reply Post Reply
Author
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Topic: Collection modified error
    Posted: 07-Jul-2011 at 6:41am
I ran into an error I was not expecting and though I can prevent it I thought maybe it at least shouldn't blow up with this error...
 
I have an entity ContactBa that has a relationship with Contact which has a relationship with Department. When I create a new ContactBa it of course has no Contact which of course has no Department, but if the UI is bound to ContactBa.Contact.Department.Name...I get a collection modified error thrown. I presume its trying to "get" (lazily?) the Contact and Department but of course there is nothing if I justed create the ContactBa entity on the client. Turning off lazy loading did not prevent the error so...maybe its something else. If I remove the UI binding I do not get the error when I add a new ContactBa.
 
Collection was modified; enumeration operation may not execute.    at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.PendingEntityMap.Update(EntityWrapper pendingWrapper, EntityWrapper realWrapper)
   at IdeaBlade.EntityModel.ScalarEntityReference`1.InformPendingEntityOfRealEntity(EntityWrapper realEntity)
   at IdeaBlade.EntityModel.ScalarEntityReference`1.QueryCallback(EntityQueryOperation op)
   at IdeaBlade.EntityModel.BaseOperation`2.OnCompleted()
   at IdeaBlade.EntityModel.BaseOperation`2.IdeaBlade.EntityModel.IHasAsyncEventArgs.OnCompleted()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<>c__DisplayClass2.<.ctor>b__0(TArgs args)
   at IdeaBlade.EntityModel.AsyncProcessor`1.Signal()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)


Edited by midnit - 07-Jul-2011 at 6:41am
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jul-2011 at 10:31am
midnit,
 
Can you upload a sample reproducing the problem?
 
Silvio.
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jul-2011 at 12:20pm
Hi midnit,
 
Please disregard my previous post. I was able to reproduce it here and will file a bug.
 
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down