CardView: Crash in Foundation when sliding back and forth

I have experienced the below crash several times during testing when sliding items quickly back and forth with CarouselView. The crash happens with 1.6.3 and 1.6.4-pre. I have tested it in Simulators and with physical devices and I can repro with both. I have been using Visual Studio 2017 (I have not tested with VS4M yet):

Unhandled Exception:

Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSGenericException Reason: *** Collection <CALayerArray: 0x600002ce3420> was mutated while being e
![capture](https://user-images.githubusercontent.com/28783954/47255399-da60c200-d470-11e8-9362-e1e18881849a.PNG)
numerated.
Native stack trace:
	0   CoreFoundation                      0x000000011110529b __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000111e59735 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000111101f7c __NSFastEnumerationMutationHandler + 124
	3   UIKitCore                           0x000000011bf0b279 -[UIView(Hierarchy) subviews] + 363
	4   UIKitCore                           0x000000011bf24887 -[UIView(CALayerDelegate) _wantsReapplicationOfAutoLayoutWithLayoutDirtyOnEntry:] + 57
	5   UIKitCore                           0x000000011bf25055 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1505
	6   QuartzCore                          0x0000000109a9bd3d -[CALayer layoutSublayers] + 175
	7   QuartzCore                          0x0000000109aa0bf7 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
	8   QuartzCore                          0x0000000109a19aa6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342
	9   QuartzCore                          0x0000000109a50c2a _ZN2CA11Transaction6commitEv + 576
	10  Spike.CarouselView.iOS              0x0000000103717a79 xamarin_dyn_objc_msgSend + 217
	11  ???                                 0x0000000136c4ecd0 0x0 + 5213842640
	12  ???                                 0x0000000136bf46f3 0x0 + 5213472499
	13  Spike.CarouselView.iOS              0x00000001035253c1 mono_jit_runtime_invoke + 1441
	14  Spike.CarouselView.iOS              0x000000010360bcff mono_runtime_invoke_checked + 127
	15  Spike.CarouselView.iOS              0x0000000103654c4a start_wrapper_internal + 602
	16  Spike.CarouselView.iOS              0x00000001036549c7 start_wrapper + 71
	17  libsystem_pthread.dylib             0x00000001137e333d _pthread_body + 126
	18  libsystem_pthread.dylib             0x00000001137e62a7 _pthread_start + 70
	19  libsystem_pthread.dylib             0x00000001137e2425 thread_start + 13

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

@aman720gupta hi

Have you tried latest version? Also, try to set MaxChildrenCount = 30 and DesiredMaxChildrenCount = 30

Hi

I’m using latest version but let me check with this values

I think, this issue can go away with new releases )

Yes, Alex’s control is not bug free but we’ve found it to be quite robust. There’s been a few issues but all within the source code (the latest version isn’t packaged yet so we’re running the source code). We found one GC/Dispose bug but we fixed that (and we will be forwarding it to Alex).

ok, funny, since I’ve started with Alex control and changed to this one, since I got to many errors with the other one, especially these NSGenericExceptions.

I also get this error now…@jonasrembratttetrapak did you find something to solve this ?

maybe its related to this: https://github.com/xamarin/Xamarin.Forms/issues/2087