(iOS 11) only Xamarin.iOS UITextView becomeFirstResponder crashes when UIToolbar is in the same view

0

Calling UITextView becomeFirstResponder crashes when having a UIToolbar visible on the top of the screen. However, if the UIToolbar is hidden, it will not crash. Pre-iOS 11 it worked fine. After compiling with Xcode 9, it crashes consistently.

Both UITextView and UIToolbar here are both components that are from iOS native binding project.

Code around the crash is simply

if ([textView canBecomeFirstResponder]) {
    NSLog(@"activateTextEntry canBecomeFirstResponder");

    BOOL result = [textView becomeFirstResponder]; // CRASH

    NSLog(@"activateTextEntry becomeFirstResponder %@", (result) ? @"TRUE" : @"FALSE");
}

Here is the crash log from system. Any help is highly appreciated!

System Integrity Protection: enabled

Crashed Thread:        0  tid_403  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00007fff54e9bff8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x7fff54e9bff8:
    MALLOC_SMALL           00007f8b32000000-00007f8b32800000 [ 8192K] rw-/rwx SM=PRV  
--> STACK GUARD            00007fff5169c000-00007fff54e9c000 [ 56.0M] ---/rwx SM=NUL  stack guard for thread 0
    Stack                  00007fff54e9c000-00007fff5568e000 [ 8136K] rw-/rwx SM=COW  thread 0

Application Specific Information:
CoreSimulator 494.13.6 - Device: iPhone 8 - Runtime: iOS 11.0 (15A372) - DeviceType: iPhone2017-A

Thread 0 Crashed:: tid_403  Dispatch queue: com.apple.main-thread
0   com.your-company.PDFNetiOSXamarinSample 0x000000010a7dc7a4 mono_thread_info_current + 4 (mono-threads.c:528)
1   com.your-company.PDFNetiOSXamarinSample 0x000000010a741b6c mono_reflection_type_handle_mono_type + 28 (sre.c:1617)
2   com.your-company.PDFNetiOSXamarinSample 0x000000010a742beb mono_reflection_type_get_handle + 75 (sre.c:1501)
3   com.your-company.PDFNetiOSXamarinSample 0x000000010a6a064f mono_reflection_get_custom_attrs_info_checked + 543 (custom-attrs.c:1571)
4   com.your-company.PDFNetiOSXamarinSample 0x000000010a6a08ce mono_reflection_get_custom_attrs_by_type + 30 (custom-attrs.c:1679)
5   com.your-company.PDFNetiOSXamarinSample 0x000000010a6b7728 custom_attrs_get_by_type + 104 (icall.c:7748)

Thread 1:
0   libsystem_kernel.dylib          0x00000001165dbdf6 __recvfrom + 10
1   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fe822 recv_uninterrupted(int, void*, int) + 66 (monotouch-debug.m:732)
2   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fead7 monotouch_process_connection(int) + 119 (monotouch-debug.m:1234)
3   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fe352 monotouch_connect_wifi(NSMutableArray*) + 2706 (monotouch-debug.m:1018)
4   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fcfd1 monotouch_configure_debugging + 3329 (monotouch-debug.m:676)
5   com.your-company.PDFNetiOSXamarinSample 0x000000010a7f2881 -[CocoaThreadInitializer entryPoint:] + 97 (shared.m:132)
6   com.apple.Foundation            0x000000010d3f68ac __NSThread__start__ + 1197
7   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
8   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
9   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 2:
0   libsystem_kernel.dylib          0x00000001165dc44e __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x0000000116610621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x000000011661007d start_wqthread + 13

Thread 3:: SGen worker
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   com.your-company.PDFNetiOSXamarinSample 0x000000010a7c6fbe thread_func + 654 (mono-os-mutex.h:173)
3   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
4   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
5   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 4:: Finalizer
0   libsystem_kernel.dylib          0x00000001165d4386 semaphore_wait_trap + 10
1   com.your-company.PDFNetiOSXamarinSample 0x000000010a6b1f7f finalizer_thread + 271 (mono-os-semaphore.h:91)
2   com.your-company.PDFNetiOSXamarinSample 0x000000010a758963 start_wrapper + 675 (threads.c:829)
3   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
4   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
5   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 5:: Debugger agent
0   libsystem_kernel.dylib          0x00000001165dbdf6 __recvfrom + 10
1   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fe822 recv_uninterrupted(int, void*, int) + 66 (monotouch-debug.m:732)
2   com.your-company.PDFNetiOSXamarinSample 0x000000010a7fe92e sdb_recv(void*, int) + 46 (monotouch-debug.m:762)
3   com.your-company.PDFNetiOSXamarinSample 0x000000010a59e726 debugger_thread + 566 (debugger-agent.c:1552)
4   com.your-company.PDFNetiOSXamarinSample 0x000000010a758963 start_wrapper + 675 (threads.c:829)
5   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
6   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
7   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 6:: tid_2c0b
0   libsystem_kernel.dylib          0x00000001165dbf46 __semwait_signal + 10
1   libsystem_c.dylib               0x00000001162baec0 nanosleep + 199
2   libsystem_c.dylib               0x00000001162badb4 usleep + 53
3   com.your-company.PDFNetiOSXamarinSample 0x000000010a7f5930 pump_gc(void*) + 64 (runtime.m:1053)
4   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
5   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
6   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 7:
0   libsystem_pthread.dylib         0x0000000116610070 start_wqthread + 0
1   ???                             0x000070000257fbd0 0 + 123145341631440

Thread 8:: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib          0x00000001165d434a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00000001165d3797 mach_msg + 55
2   com.apple.CoreFoundation        0x0000000110b07e85 __CFRunLoopServiceMachPort + 213
3   com.apple.CoreFoundation        0x0000000110b073c2 __CFRunLoopRun + 1730
4   com.apple.CoreFoundation        0x0000000110b06a89 CFRunLoopRunSpecific + 409
5   com.apple.Foundation            0x000000010d3e8e5e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
6   com.apple.Foundation            0x000000010d4669b7 -[NSRunLoop(NSRunLoop) runUntilDate:] + 87
7   com.apple.UIKit                 0x000000010bec97e9 -[UIEventFetcher threadMain] + 118
8   com.apple.Foundation            0x000000010d3f68ac __NSThread__start__ + 1197
9   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
10  libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
11  libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 9:
0   libsystem_pthread.dylib         0x0000000116610070 start_wqthread + 0
1   ???                             0x0000f00000000005 0 + 263882790666245

Thread 10:
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   pdftron.com.PDFNet              0x000000010e891e41 0x10e5af000 + 3026497
3   pdftron.com.PDFNet              0x000000010e8986c6 0x10e5af000 + 3053254
4   pdftron.com.PDFNet              0x000000010e82acbd 0x10e5af000 + 2604221
5   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
6   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
7   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 11:
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   pdftron.com.PDFNet              0x000000010f170d45 0x10e5af000 + 12328261
3   pdftron.com.PDFNet              0x000000010f2ff7a4 0x10e5af000 + 13961124
4   pdftron.com.PDFNet              0x000000010f2ea91c 0x10e5af000 + 13875484
5   pdftron.com.PDFNet              0x000000010e82acbd 0x10e5af000 + 2604221
6   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
7   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
8   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 12:
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   pdftron.com.PDFNet              0x000000010f170d45 0x10e5af000 + 12328261
3   pdftron.com.PDFNet              0x000000010f3012dc 0x10e5af000 + 13968092
4   pdftron.com.PDFNet              0x000000010e82acbd 0x10e5af000 + 2604221
5   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
6   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
7   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 13:
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   pdftron.com.PDFNet              0x000000010f170d45 0x10e5af000 + 12328261
3   pdftron.com.PDFNet              0x000000010f3da989 0x10e5af000 + 14858633
4   pdftron.com.PDFNet              0x000000010e82acbd 0x10e5af000 + 2604221
5   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
6   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
7   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 14:
0   libsystem_kernel.dylib          0x00000001165dbbf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00000001166117fa _pthread_cond_wait + 712
2   pdftron.com.PDFNet              0x000000010f170d45 0x10e5af000 + 12328261
3   pdftron.com.PDFNet              0x000000010f3daac1 0x10e5af000 + 14858945
4   pdftron.com.PDFNet              0x000000010e82acbd 0x10e5af000 + 2604221
5   libsystem_pthread.dylib         0x000000011661093b _pthread_body + 180
6   libsystem_pthread.dylib         0x0000000116610887 _pthread_start + 286
7   libsystem_pthread.dylib         0x000000011661008d thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007f8b2f805a28  rbx: 0x00007f8b30008000  rcx: 0x0000000000000000  rdx: 0x0000000000000000
  rdi: 0x00007f8b2f805a28  rsi: 0x00007fff54e9c140  rbp: 0x00007fff54e9c000  rsp: 0x00007fff54e9c000
   r8: 0x0000000000000040   r9: 0x00007f8b2f701338  r10: 0xffffffffffffffff  r11: 0x0000000000000000
  r12: 0x00007fff54e9c140  r13: 0x0000000124a49660  r14: 0x00007f8b2f805a28  r15: 0x00007fff54e9c140
  rip: 0x000000010a7dc7a4  rfl: 0x0000000000010202  cr2: 0x00007fff54e9bff8

Logical CPU:     2
Error Code:      0x00000006
Trap Number:     14
ios
objective-c
xamarin
xamarin.ios
asked on Stack Overflow Sep 23, 2017 by Shirley G • edited Sep 23, 2017 by Shirley G

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0