Bug 60786 - Xamarin.Forms iOS Crash in CoreAnimation SetTransform method
Summary: Xamarin.Forms iOS Crash in CoreAnimation SetTransform method
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.5.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-11-21 12:29 UTC by Yulian
Modified: 2017-12-23 23:40 UTC (History)
2 users (show)

Tags: coreanimation, crash, ios 10, ac
Is this bug a regression?: ---
Last known good build:

Project for easy crash reproduction. (25.70 KB, text/plain)
2017-11-22 11:08 UTC, Yulian
Project archive version #2 (25.70 KB, application/zip)
2017-11-28 13:17 UTC, Yulian

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 60786 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Yulian 2017-11-21 12:29:38 UTC
Dear Xamarin Developers,

We found very strange crash which occurred in animation core and we don't have any clue why it happened.
It reproduced always when we try to use native keyboard's predictive input feature together with animation of the several Views (on the video you can see Hears flying up on the background). We are using Commit method of Animation class to perform such animation. 

We found this crash on iPhone(5,5s,6,6+,6s,7+,8)/iPad(Air2,Pro10.5) with different iOS(9-11.1.2) versions.

Here is link to video: https://youtu.be/BTzBnhkalvw

Here is a code which animates Hearts:

        Task<bool> Animate(VisualElement element, double amplitude, double period, uint yAnimLenght, bool reverseWave)
            var taskCompletionSource = new TaskCompletionSource<bool>();

            var scaleAnimGrow = new Animation((v) =>
                element.Scale = v;
            }, 0, 1.5);

            var scaleAnimDecrease = new Animation((v) =>
                element.Scale = v;
            }, 1.5, 1);

            var scaleAnim = new Animation();
            scaleAnim.Add(0, 0.5, scaleAnimGrow);
            scaleAnim.Add(0.5, 1, scaleAnimDecrease);
            scaleAnim.Commit(element, "scaleAnim", 400, 300);

            //Wave anim
            var xAnim = new Animation(v =>
                //Rand Sin(x) or Cos(x)
                var newX = Math.Sin(v / period);
                element.TranslationX = amplitude * (reverseWave ? newX : -newX);
                amplitude += 0.1; // Increasing amplitude
            }, 0, parent.Bounds.Width);

            xAnim.Commit(element, "xAnim", 400, (uint)(8200 * Math.Sqrt(amplitude)), Easing.Linear);

            //Y linear anim
            var yAnim = new Animation(v =>
                element.TranslationY = v;
            }, element.TranslationY, -parent.Bounds.Height);

            //TaskCompletionSource - The end of the animation is the end of the Y movement animation
            yAnim.Commit(element, "ElementAnim", 400, yAnimLenght, Easing.Linear, (v, c) =>

            return taskCompletionSource.Task;

Which is called from the following method:

        public async Task Draw()
            IsDead = false;
            var amplitude = rand.Next(6, 8);
            var period = amplitude * 2;
            //var period = rand.Next(3, 10);
            var yAnimLenght = rand.Next(4000, 8000);
            var reverseWave = rand.NextBool();
            await Animate(Element, amplitude, period, (uint)yAnimLenght, reverseWave);

Here is log with crash:

2017-11-10 12:06:59.696 Mobile.iOS[278:17512] critical: Stacktrace:

2017-11-10 12:06:59.697 Mobile.iOS[278:17512] critical:   at <unknown> <0xffffffff>
2017-11-10 12:06:59.701 Mobile.iOS[278:17512] critical:   at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_CATransform3D (intptr,intptr,CoreAnimation.CATransform3D) <0x00007>
2017-11-10 12:06:59.704 Mobile.iOS[278:17512] critical:   at CoreAnimation.CALayer.set_Transform (CoreAnimation.CATransform3D) [0x0000b] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/build/ios/native/CoreAnimation/CALayer.g.cs:2284
2017-11-10 12:06:59.707 Mobile.iOS[278:17512] critical:   at Xamarin.Forms.Platform.iOS.VisualElementTracker/<>c__DisplayClass23_0.<OnUpdateNativeControl>b__0 () [0x003c3] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:203
2017-11-10 12:06:59.709 Mobile.iOS[278:17512] critical:   at Xamarin.Forms.Platform.iOS.CADisplayLinkTicker.StartThread () [0x00025] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\CADisplayLinkTicker.cs:60
2017-11-10 12:06:59.713 Mobile.iOS[278:17512] critical:   at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x00014] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
2017-11-10 12:06:59.716 Mobile.iOS[278:17512] critical:   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
2017-11-10 12:06:59.717 Mobile.iOS[278:17512] critical:   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
2017-11-10 12:06:59.718 Mobile.iOS[278:17512] critical:   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
2017-11-10 12:06:59.718 Mobile.iOS[278:17512] critical:   at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/
2017-11-10 12:06:59.719 Mobile.iOS[278:17512] critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <136edfc8e644410eb152bce382121c61#8E081D08-7683-8F08-ABD2-BB58E8D6A219>:0
2017-11-10 12:06:59.720 Mobile.iOS[278:17512] critical: 
Native stacktrace:

2017-11-10 12:07:00.584 Mobile.iOS[278:17512] critical: 	0   Mobile.iOS                          0x00000001050b0b64 mono_handle_native_crash + 224
2017-11-10 12:07:00.584 Mobile.iOS[278:17512] critical: 	1   Mobile.iOS                          0x00000001050bcb74 mono_sigsegv_signal_handler + 316
2017-11-10 12:07:00.585 Mobile.iOS[278:17512] critical: 	2   libsystem_platform.dylib            0x0000000180a8994c _sigtramp + 68
2017-11-10 12:07:00.586 Mobile.iOS[278:17512] critical: 	3   QuartzCore                          0x0000000183516f24 <redacted> + 484
2017-11-10 12:07:00.586 Mobile.iOS[278:17512] critical: 	4   QuartzCore                          0x0000000183525cd0 <redacted> + 188
2017-11-10 12:07:00.586 Mobile.iOS[278:17512] critical: 	5   QuartzCore                          0x00000001835266ac <redacted> + 32
2017-11-10 12:07:00.587 Mobile.iOS[278:17512] critical: 	6   UIKit                               0x0000000185b50d98 <redacted> + 820
2017-11-10 12:07:00.587 Mobile.iOS[278:17512] critical: 	7   UIKit                               0x0000000185e180e8 <redacted> + 856
2017-11-10 12:07:00.587 Mobile.iOS[278:17512] critical: 	8   UIKit                               0x0000000185b509a8 <redacted> + 80
2017-11-10 12:07:00.588 Mobile.iOS[278:17512] critical: 	9   UIKit                               0x0000000185b10220 <redacted> + 120
2017-11-10 12:07:00.588 Mobile.iOS[278:17512] critical: 	10  UIKit                               0x00000001862c8dc4 <redacted> + 124
2017-11-10 12:07:00.589 Mobile.iOS[278:17512] critical: 	11  QuartzCore                          0x00000001835220cc <redacted> + 100
2017-11-10 12:07:00.589 Mobile.iOS[278:17512] critical: 	12  QuartzCore                          0x0000000183517654 <redacted> + 96
2017-11-10 12:07:00.590 Mobile.iOS[278:17512] critical: 	13  QuartzCore                          0x00000001835174c4 <redacted> + 172
2017-11-10 12:07:00.590 Mobile.iOS[278:17512] critical: 	14  QuartzCore                          0x000000018351a58c <redacted> + 160
2017-11-10 12:07:00.591 Mobile.iOS[278:17512] critical: 	15  Mobile.iOS                          0x0000000102809f34 wrapper_managed_to_native_ObjCRuntime_Messaging_void_objc_msgSend_CATransform3D_intptr_intptr_CoreAnimation_CATransform3D + 244
2017-11-10 12:07:00.591 Mobile.iOS[278:17512] critical: 	16  Mobile.iOS                          0x0000000101ee7fc4 CoreAnimation_CALayer_set_Transform_CoreAnimation_CATransform3D + 212
2017-11-10 12:07:00.592 Mobile.iOS[278:17512] critical: 	17  Mobile.iOS                          0x0000000101b3ed30 Xamarin_Forms_Platform_iOS_VisualElementTracker__c__DisplayClass23_0__OnUpdateNativeControlb__0 + 4928
2017-11-10 12:07:00.592 Mobile.iOS[278:17512] critical: 	18  Mobile.iOS                          0x0000000101b2fc5c Xamarin_Forms_Platform_iOS_CADisplayLinkTicker_StartThread + 332
2017-11-10 12:07:00.592 Mobile.iOS[278:17512] critical: 	19  Mobile.iOS                          0x00000001007283ac System_Threading_ThreadHelper_ThreadStart_Context_object + 188
2017-11-10 12:07:00.593 Mobile.iOS[278:17512] critical: 	20  Mobile.iOS                          0x00000001007255f4 System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 404
2017-11-10 12:07:00.593 Mobile.iOS[278:17512] critical: 	21  Mobile.iOS                          0x000000010072544c System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 44
2017-11-10 12:07:00.594 Mobile.iOS[278:17512] critical: 	22  Mobile.iOS                          0x00000001007253cc System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 76
2017-11-10 12:07:00.594 Mobile.iOS[278:17512] critical: 	23  Mobile.iOS                          0x0000000100728514 System_Threading_ThreadHelper_ThreadStart + 52
2017-11-10 12:07:00.595 Mobile.iOS[278:17512] critical: 	24  Mobile.iOS                          0x00000001009f9994 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
2017-11-10 12:07:00.595 Mobile.iOS[278:17512] critical: 	25  Mobile.iOS                          0x00000001050bfc50 mono_jit_runtime_invoke + 824
2017-11-10 12:07:00.595 Mobile.iOS[278:17512] critical: 	26  Mobile.iOS                          0x000000010513a260 do_runtime_invoke + 108
2017-11-10 12:07:00.597 Mobile.iOS[278:17512] critical: 	27  Mobile.iOS                          0x000000010516795c start_wrapper + 640
2017-11-10 12:07:00.597 Mobile.iOS[278:17512] critical: 	28  libsystem_pthread.dylib             0x0000000180a8fb28 <redacted> + 156
2017-11-10 12:07:00.597 Mobile.iOS[278:17512] critical: 	29  libsystem_pthread.dylib             0x0000000180a8fa8c <redacted> + 0
2017-11-10 12:07:00.598 Mobile.iOS[278:17512] critical: 	30  libsystem_pthread.dylib             0x0000000180a8d028 thread_start + 4
2017-11-10 12:07:00.598 Mobile.iOS[278:17512] critical: 
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Could you please help us to resolve it?

With best regards,
Comment 1 Paul DiPietro [MSFT] 2017-11-21 14:27:00 UTC
Can you please upload a full (minimized) reproduction sample we can run to help investigate? We'd very much appreciate it.
Comment 2 Yulian 2017-11-22 11:08:41 UTC
Created attachment 25793 [details]
Project for easy crash reproduction.

Sure, please check archive available as an attachment. 
For easy reproduction of an issue please use iPhone 5s, 6, 6s.
Also, please use iOS version 9-10.
Comment 3 Yulian 2017-11-28 09:54:25 UTC
Dear Paul,

Just want to clarify - is it everything ok with project in archive? Is it was possible  to the members of your team to reproduce an issue using it?

Thank you for your feedback.

With best regards,
Comment 4 Paul DiPietro [MSFT] 2017-11-28 12:47:44 UTC
The uploaded file appears to be a text file. Please try and upload a proper zipped archive when you're able.
Comment 5 Yulian 2017-11-28 13:17:36 UTC
Created attachment 25848 [details]
Project archive version #2

I tried to add project file once more. Hope this will work now.
Comment 6 Yulian 2017-11-28 13:21:47 UTC
Dear Paul,

I uploaded new archive with project. It should be recognized properly now. 
Could you please try to download it and unpack?

With best regards,
Comment 7 Paul DiPietro [MSFT] 2017-11-28 14:36:45 UTC
I am able to run it but haven't gotten the crash on a couple sim tests. Are you finding if this is occurring only on devices (a somewhat important distinction) or maybe with certain actions taken after opening the keyboard?
Comment 8 Yulian 2017-11-28 14:53:35 UTC
Please consider to use original iOS device (not sim). This issue is not reproducible on sim.

Actually we created video with reproduction steps:
To reproduce it you have to:
1. Tap on the input field - keyboard will show;
2. Next, you have to tap multiple times on automatic suggestions as fast as you can;
3. After 5-8 seconds crash will occur.

This crash easily reproduced on the following devices: iPhone(5,5s,6,6+,6s,7+,8)/iPad(Air2,Pro10.5) with different iOS(9-11.1.2) versions.
Comment 9 Yulian 2017-12-04 12:56:10 UTC
Dear Paul,

How are you?
Do you have some news regarding that issue? 
Is it was possible for you to reproduce it?

With best regards,
Comment 10 Paul DiPietro [MSFT] 2017-12-04 15:59:03 UTC
I am not able to reproduce the issue on an iPhone X running iOS 11.2.
Comment 11 Yulian 2017-12-04 16:42:59 UTC
Dear Paul,

Thanks for response.
Could you please try to reproduce it on iOS 10? 

With best regards,
Comment 12 Paul DiPietro [MSFT] 2017-12-04 16:55:08 UTC
Yes, iOS 10 causes a crash on the simulator. I will set this as confirmed although I cannot say for certain if this is explicitly a Forms issue or not until there is further investigation. That said, this appears to be a little bit of an edge case as I had to tap the predictive text at an unreasonably fast rate to cause the crash.
Comment 13 Yulian 2017-12-07 11:07:54 UTC
Dear Paul,

How are you?
Do you have any news regarding this strange crash?

With best regards,
Comment 14 Yulian 2017-12-08 12:10:45 UTC
Dear Paul,

How are you?
Maybe you can give us a clue when we can get some feedback on the status of that issue?

With best regards,
Comment 15 Paul DiPietro [MSFT] 2017-12-08 22:41:18 UTC
Issues statuses are updated based upon when they are scheduled for work and investigated further. This has not yet been scheduled for work. Beyond that, I don't have any more information at this time.
Comment 16 Yulian 2017-12-19 15:44:05 UTC
Dear Paul,

Is there any possibility to raise priority of that issue?
Fix of that issue is very critical for our project, because, we are planning to release our app. soon.

With best regards,
Comment 17 Yulian 2017-12-21 15:04:36 UTC
Dear Paul,

Sorry, for annoying. :)
Do you have any idea when current issue could be scheduled for investigation?

With best regards,
Comment 18 Paul DiPietro [MSFT] 2017-12-23 23:40:46 UTC
Unfortunately, as the last comment stated, we don't have any further updates on this report nor any specific idea of when work on it would be scheduled.