This problem can be resolved very esily ...........
instead if doing this,
foreach(x in list.values)
{
}
use this code sniplet
foreac(X in new List<object>(list.values).toArray())
{
}
this can fix that exception very easily.
Collection was modified; enumeration operation may not execute.
On Oct 10, 4:45 pm, rashack <[EMAIL PROTECTED]> wrote:
> Any custom event listeners?
>
> Cheers,
> Jarda
>
> On Oct 9, 12:46 pm, "Pedro Santos" <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a method that performs the following:
> > 1. Opens a session
> > 2. Creates an entity
> > 3. Updates the entity
> > 4. Calls Flush
>
> > And sometimes, I get this exception:
>
> > Here's the exception:
> > System.Reflection.TargetInvocationException: Exception has been thrown
> > by the target of an invocation. ---> System.Collectionwas modified:
> >Collectionwas modified; enumeration operation may not execute.
> > at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource
> > resource)
> > at System.Collections.Generic.List`1.Enumerator.MoveNext()
> > at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
> > at NHibernate.Engine.ActionQueue.ExecuteActions()
> > at
> > NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IE
> > ventSource
> > session)
> > at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent
> > event)
> > at NHibernate.Impl.SessionImpl.Flush()
> > at OrionsBelt.DataAccessLayer.NHibernatePersistance`1.Flush()
> > at OrionsBelt.Generic.Server.Persist(Int32 tick, DateTime date)
>
> > Any ideas?
>
> > BR,
>
> > --
> > Pedro Santos
> > Home -http://psantos.zi-yu.com
> > Work -http://www.pdmfc.com
> > The future -http://www.orionsbelt.eu- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---