-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Layout.ResolveLayoutChanges throwing collection was modified exception on iOS #15003
Comments
Thanks for the report! Any new or additional information is much appreciated, this is not much to go on unfortunately |
@jfversluis sorry, I haven't been able to replicate locally at all, its just the errors Im seeing in AppCenter diagnostics. |
Ive just pulled out the full stack trace on this from AppCenter: Any thoughts on how you might resolve this? |
@jfversluis Here is the full stack from the raw logs in AppCenter: Xamarin Exception Stack: |
That seems helpful, thanks! Need to go one layer deeper. Seems the origin is here then, but why! It already copies the collection so it shouldn't be changed while this is running |
Yeah as I mentioned in my first reply, it seemed like a safe iteration on the copy (in ResolveLayoutChanges), unless something else still has a reference to it. If 2 parts of the code both take references of the same list at the same time, this could happen. There are other, possibly safer ways of doing this, maybe perform a new list with the contents and iterate that. I can see you are trying to be lock free here for speed. |
@jfversluis Well, technically it's not a copy, it's the original list. But still I don't see how this error could occur, but it quite clearly does. This is now the number 1 crash report for us in AppCenter. |
@jfversluis I have managed to work around the problem when the layout is a Frame (custom renderer, wrap in a try catch and run it again), but not for VisualElementRenderer. More info though, I believe this is due to an animation. I spotted this in the thread that crashed: |
Description
In AppCenter crash reporting I am seeing reports of the following exception:
SIGABRT: Collection was modified; enumeration operation may not execute.
Stacktrace:
List
1+Enumerator[T].MoveNextRare () (wrapper other) System.Object.gsharedvt_in() (wrapper other) System.Object.gsharedvt_out() List
1+Enumerator[T].MoveNext ()Layout.ResolveLayoutChanges ()
VisualElementRenderer`1[TElement].ResolveLayoutChanges ()
Steps to Reproduce
Unable to reproduce locally
Expected Behavior
Actual Behavior
Basic Information
Environment
Show/Hide Visual Studio info
Build Logs
Screenshots
Reproduction Link
Workaround
None
The text was updated successfully, but these errors were encountered: