Collection was modified; enumeration operation may not execute during ViewModel.SaveAsync() #4232
-
I'm getting this error after calling ViewModel.SaveAsync() from a blazor client. The server-side dataportal works, but then I get this exception in ViewModel.Exception. Any ideas how to troubleshoot this? DataPortal.Update failed (Exception has been thrown by the target of an invocation.) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi. Do you have async rules which modifies existing collections?
lwmorris067 ***@***.***> schrieb am Do., 26. Sept. 2024,
21:50:
… I'm getting this error after calling ViewModel.SaveAsync() from a blazor
client. The server-side dataportal works, but then I get this exception in
ViewModel.Exception. Any ideas how to troubleshoot this?
DataPortal.Update failed (Exception has been thrown by the target of an
invocation.)
Csla.DataPortalException: DataPortal.Update failed (Exception has been
thrown by the target of an invocation.)
---> Csla.Reflection.CallMethodException: Model.Update method call failed
---> System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation.
---> *System.InvalidOperationException: Collection was modified;
enumeration operation may not execute.*
at Csla.Core.GraphMerger.MergeBusinessListGraph[T,C](T target, T source)
at InvokeStub_GraphMerger.MergeBusinessListGraph(Object, Span`1)
—
Reply to this email directly, view it on GitHub
<#4232>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJCZONZYZXO2MWZGLHVZKDZYRQPXAVCNFSM6AAAAABO5XKIRGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGI2DAOBVG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
@lwmorris067 do you have any code that interacts with a collection outside of rules? Like constructors or overrides of AddItem?
Constructors and AddItem operations occur during deserialization, possibly PropertyChanged and CollectionChanged events too (I'm not sure) - and if logic is triggered by those operations they could end up running in the middle of the deserialization process.