We're experiencing a SIGSEGV when the native library of our application attempts to call into the managed code of our application via a callback. This issue started to occur only after updating Xamarin.iOS 220.127.116.11 to 10.x, and occurs only on 32-bit platforms (iPhone 4s/5). The contents of the application output are:
2016-10-13 11:49:45.276 DTNADriver[298:33034] critical: 0 DTNADriver 0x001f9b79 mono_handle_native_sigsegv + 240
2016-10-13 11:49:45.276 DTNADriver[298:33034] critical: 1 DTNADriver 0x0020232d mono_sigsegv_signal_handler + 150
2016-10-13 11:49:45.276 DTNADriver[298:33034] critical: 2 libsystem_platform.dylib 0x1c5e726d _sigtramp + 24
2016-10-13 11:49:45.277 DTNADriver[298:33034] critical: 3 DTNADriver 0x005e8b74 generic_trampoline_aot_plt + 48
2016-10-13 11:49:45.277 DTNADriver[298:33034] critical: 4 DTNADriver 0x00189005 _ZN17CClientNotifySink6NotifyEllmPhjxl + 150
2016-10-13 11:49:45.277 DTNADriver[298:33034] critical: 5 DTNADriver 0x0019b1cf _ZN26CNotificationManagerModule17CNotificationItem6NotifyEl17ENotificationType + 174
2016-10-13 11:49:45.277 DTNADriver[298:33034] critical: 6 DTNADriver 0x0019b0d3 _ZN26CNotificationManagerModule3RunEv + 160
2016-10-13 11:49:45.278 DTNADriver[298:33034] critical: 7 DTNADriver 0x00198bc7 _ZN26CNotificationManagerModule12ThreadLaunchEPv + 18
2016-10-13 11:49:45.278 DTNADriver[298:33034] critical: 8 DTNADriver 0x00120299 _ZN9nexiq_osa10ThreadMainEPv + 100
2016-10-13 11:49:45.278 DTNADriver[298:33034] critical: 9 libsystem_pthread.dylib 0x1c5eba27 <redacted> + 216
2016-10-13 11:49:45.278 DTNADriver[298:33034] critical: 10 libsystem_pthread.dylib 0x1c5eb94d _pthread_start + 234
2016-10-13 11:49:45.279 DTNADriver[298:33034] critical: 11 libsystem_pthread.dylib 0x1c5e94a8 thread_start + 8
2016-10-13 11:49:45.279 DTNADriver[298:33034] 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 attach a test project we can use to reproduce this?
Created attachment 18092 [details]
A sample project demonstrating the issue.
The issue occurs when the callback methods are in a referenced PCL. A workaround is to move the callbacks into the Xamarin.iOS project.
Created attachment 18100 [details]
Smaller test project
I can reproduce the crash with the supplied test project (with xamarin-macios/master), and I can confirm it only happens on ARMv7 (ARM64 works fine).
Initially targeting C9 since this is a regression.
This happens when a call is made back to native code on a thread not registered with the runtime. The auto registration code has a bug where it depends on the thread already registered, causing this crash.
Hopefully going to get fixed by:
Fixed in mono master 0eda1938a4e38fcb18bee96df60cd8734cec497b.
I can also reproduce this Issue with XI 10.2.1.5 using project mentioned in comment#3. This is the Application output for the same: https://gist.github.com/saurabh360/4b2b0a369b3c0e25f6a2bbf522c86f96
Environment Info and Logs: https://gist.github.com/81015040f83a236897dc2fea4c39f2b2
I have checked this with Cycle 9 (XI 10.4.0.20) and Master XI 10.5.0.6), I am not seeing any SIGSEGV in attached project. This is the application output for the same: https://gist.github.com/saurabh360/568864e7b27d0cbf3f82995a4e73c079
Environment Info: https://gist.github.com/saurabh360/c67fe34a59fd1e0a749a8a3519e3e75d
We also ran into this issue on 32 bit iOS devices when calling managed code from native. Thanks for fixing this one, Xamarin.
Notice (2018-05-21): bugzilla.xamarin.com will be
switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.
Please join us on
Visual Studio Developer Community and
GitHub to continue tracking
issues. Bugzilla will remain available for reference in read-only mode.
We will continue to work on open Bugzilla bugs and copy them to the new
locations as needed for follow-up. The See Also field
on each Bugzilla bug will be updated with a link to its new location
After Bugzilla is read-only, if you have new information to add for a
bug that does not yet have a matching issue on Developer Community or
GitHub, you can create a follow-up issue in the new location. Copy and
paste the title and description from this bug, and then add your new
details. You can get a pre-formatted version of the title and
In special cases you might also want the comments:
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.