Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runtime] Use the same coop gc macro names as mono master does. #1

Closed
wants to merge 22 commits into from
Closed

[runtime] Use the same coop gc macro names as mono master does. #1

wants to merge 22 commits into from

Conversation

vargaz
Copy link

@vargaz vargaz commented May 20, 2016

No description provided.

rolfbjarne and others added 22 commits May 18, 2016 11:14
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fcntl.2.html

F_SETNOSIGPIPE

    (lldb) bt all
      thread 1: tid = 0x1e176c9, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_a07', queue = 'com.apple.main-thread', stop reason = signal SIGPIPE
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b5ac0, mutex=0x7f0b5a94, timeout_ms=15000) + 264 at mono-os-mutex.h:134
        frame 4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x00000162, timeout=15000, alertable=1, poll=0, alerted=0xbff5c78c) + 802 at handles.c:1554
        frame 5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x00000162, timeout=15000, alertable=1) + 1127 at wait.c:173
        frame 6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x12324120, multiple=0, numhandles=1, handles=0xbff5c874, waitall=0, ms=15000, alertable=1) + 225 at threads.c:1518
        frame 7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f65e0, handle=0x00000162, ms=15000, exitContext=0) + 162 at threads.c:1652
        frame 8: 0x137f06cc
        frame 9: 0x137f0594
        frame 10: 0x137f0382
        frame 11: 0x13e9053c
        frame 12: 0x13765e23
        frame 13: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 1349 at mini-runtime.c:2556
        frame 14: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 224 at object.c:2897
        frame 15: 0x0033bc75 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke_array(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 2293 at object.c:4437
        frame 16: 0x002b3f1b com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_InternalInvoke(method=0x1351cab0, this_arg=0x1159d670, params=0x00000000, exc=0xbff5cd68) + 2475 at icall.c:2804
        frame 17: 0x13766724
        frame 18: 0x13766560
        frame 19: 0x13766494
        frame 20: 0x137662c4
        frame 21: 0x13768af8
        frame 22: 0x13768394
        frame 23: 0x13768224
        frame 24: 0x13765f7f
        frame 25: 0x13765e93
        frame 26: 0x1375fcda
        frame 27: 0x1375f6dc
        frame 28: 0x137641cb
        frame 29: 0x13762458
        frame 30: 0x1375fcda
        frame 31: 0x1375f6dc
        frame 32: 0x137641cb
        frame 33: 0x13762458
        frame 34: 0x1375fcda
        frame 35: 0x1375f6dc
        frame 36: 0x137641cb
        frame 37: 0x13762458
        frame 38: 0x1375fcda
        frame 39: 0x1375f6dc
        frame 40: 0x1375e32d
        frame 41: 0x137285c0
        frame 42: 0x13728514
        frame 43: 0x137284a8
        frame 44: 0x12c4f7ef
        frame 45: 0x1298f833
        frame 46: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 1349 at mini-runtime.c:2556
        frame 47: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 224 at object.c:2897
        frame 48: 0x00494361 com.xamarin.systemtests.watchkitapp.watchkitextension`native_to_managed_trampoline_1(self=0x7d431130, _cmd="xamarinApplySelector", managed_method_ptr=0x00564d4c, r0="Foundation.NSAsyncActionDispatcher, Xamarin.WatchOS", r1="Apply") + 289 at Xamarin.WatchOS.registrar.watchos.m:40
        frame 49: 0x00494caa com.xamarin.systemtests.watchkitapp.watchkitextension`-[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector](self=0x7d431130, _cmd="xamarinApplySelector") + 74 at Xamarin.WatchOS.registrar.watchos.m:1831
        frame 50: 0x045aa05d libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
        frame 51: 0x0076af17 Foundation`__NSThreadPerformPerform + 323
        frame 52: 0x0119828f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
        frame 53: 0x0118df1b CoreFoundation`__CFRunLoopDoSources0 + 523
        frame 54: 0x0118d338 CoreFoundation`__CFRunLoopRun + 1032
        frame 55: 0x0118cc76 CoreFoundation`CFRunLoopRunSpecific + 470
        frame 56: 0x0118ca8b CoreFoundation`CFRunLoopRunInMode + 123
        frame 57: 0x0076f601 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
        frame 58: 0x008159cd Foundation`-[NSRunLoop(NSRunLoop) run] + 82
        frame 59: 0x053c30eb libxpc.dylib`_xpc_objc_main + 486
        frame 60: 0x053c5e4a libxpc.dylib`xpc_main + 215
        frame 61: 0x0093ec45 Foundation`-[NSXPCListener resume] + 186
        frame 62: 0x0d7f0326 PlugInKit`-[PKService run] + 582
        frame 63: 0x0178cc69 WatchKit`main + 146
        frame 64: 0x00493507 com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_main(argc=1, argv=0xbff5e954, is_extension=true) + 2599 at monotouch-main.m:461
        frame 65: 0x004a176c com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_watchextension_main(argc=1, argv=0xbff5e954) + 124 at main.i386.m:37
        frame 66: 0x050e3ae1 libdyld.dylib`start + 1

      thread 2: tid = 0x1e18197, 0x054347f6 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
        frame 0: 0x054347f6 libsystem_kernel.dylib`kevent64 + 10
        frame 1: 0x050ad2db libdispatch.dylib`_dispatch_mgr_invoke + 257
        frame 2: 0x050ad02b libdispatch.dylib`_dispatch_mgr_thread + 60

      thread 5: tid = 0x1e181a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdcc0 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
        frame 3: 0x0041b3af com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_wait(cond=0x00564418, mutex=0x005643ec) + 47 at mono-os-mutex.h:105
        frame 4: 0x0041addd com.xamarin.systemtests.watchkitapp.watchkitextension`thread_func(thread_data=0x00000000) + 125 at sgen-thread-pool.c:118
        frame 5: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 6: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 7: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

    * thread 6: tid = 0x1e181a4, 0x054353c6 libsystem_kernel.dylib`__write + 10, name = 'tid_2403'
        frame 0: 0x054353c6 libsystem_kernel.dylib`__write + 10
      * frame 1: 0x00398113 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread_wakeup + 67 at threadpool-ms-io.c:149
        frame 2: 0x00398251 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_threadpool_ms_io_remove_socket(fd=20) + 113 at threadpool-ms-io.c:620
        frame 3: 0x0038f466 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Net_Sockets_Socket_Close_internal(sock=20, error=0xb0298b7c) + 38 at socket-io.c:692
        frame 4: 0x13745fc4
        frame 5: 0x13745df0
        frame 6: 0x13737795
        frame 7: 0x13745a8c
        frame 8: 0x13745a24
        frame 9: 0x137459e3
        frame 10: 0x137458f0
        frame 11: 0x13e33c0b
        frame 12: 0x13455c3c
        frame 13: 0x002a45e8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_run_finalize(obj=0x1396cb60, data=0x00000000) + 1384 at gc.c:256
        frame 14: 0x00379fa4 com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_client_run_finalize(obj=0x1396cb60) + 36 at sgen-mono.c:492
        frame 15: 0x003e121e com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_gc_invoke_finalizers + 382 at sgen-gc.c:2455
        frame 16: 0x00379fbb com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_invoke_finalizers + 11 at sgen-mono.c:498
        frame 17: 0x002a5f4a com.xamarin.systemtests.watchkitapp.watchkitextension`finalizer_thread(unused=0x00000000) + 442 at gc.c:739
        frame 18: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7bf07420) + 723 at threads.c:717
        frame 19: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7bf07420) + 34 at threads.c:764
        frame 20: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5e3e8) + 583 at mono-threads-posix.c:92
        frame 21: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 22: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 23: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 7: tid = 0x1e181b5, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
        frame 0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
        frame 1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
        frame 2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

      thread 8: tid = 0x1e181b6, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
        frame 0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
        frame 1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
        frame 2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

      thread 9: tid = 0x1e181d2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_2f0f'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x00464538 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 264 at mono-os-mutex.h:134
        frame 4: 0x004641ef com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 63 at mono-coop-mutex.h:107
        frame 5: 0x00462dd5 com.xamarin.systemtests.watchkitapp.watchkitextension`sleep_interruptable(ms=100, alerted=0xb02bae2c) + 421 at mono-threads.c:1155
        frame 6: 0x00462a8b com.xamarin.systemtests.watchkitapp.watchkitextension`mono_thread_info_sleep(ms=100, alerted=0xb02bae2c) + 139 at mono-threads.c:1187
        frame 7: 0x003a0567 com.xamarin.systemtests.watchkitapp.watchkitextension`monitor_thread + 295 at threadpool-ms.c:887
        frame 8: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d33d9f0) + 723 at threads.c:717
        frame 9: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d33d9f0) + 34 at threads.c:764
        frame 10: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d1a8) + 583 at mono-threads-posix.c:92
        frame 11: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 12: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 13: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 10: tid = 0x1e181d3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_300f'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7be244b0) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7be244b0) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d148) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 11: tid = 0x1e181d6, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_370b'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d0222a0) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d0222a0) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 12: tid = 0x1e1828f, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_400f'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b2eec, mutex=0x7f0b2ec0, timeout_ms=89999) + 264 at mono-os-mutex.h:134
        frame 4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x0000010d, timeout=89999, alertable=1, poll=0, alerted=0xb072494c) + 802 at handles.c:1554
        frame 5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x0000010d, timeout=89999, alertable=1) + 1127 at wait.c:173
        frame 6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x123266a0, multiple=0, numhandles=1, handles=0xb0724a34, waitall=0, ms=89999, alertable=1) + 225 at threads.c:1518
        frame 7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f1b00, handle=0x0000010d, ms=89999, exitContext=0) + 162 at threads.c:1652
        frame 8: 0x137f06cc
        frame 9: 0x137f0594
        frame 10: 0x137f0382
        frame 11: 0x1376c06e
        frame 12: 0x1376af7b
        frame 13: 0x1344d8b8
        frame 14: 0x1344d36c
        frame 15: 0x1376a9d0
        frame 16: 0x1376a8f8
        frame 17: 0x1376a883
        frame 18: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 1349 at mini-runtime.c:2556
        frame 19: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 224 at object.c:2897
        frame 20: 0x00339b7f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_delegate_invoke(delegate=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 175 at object.c:3657
        frame 21: 0x003ab807 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d26a5f0) + 855 at threads.c:723
        frame 22: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d26a5f0) + 34 at threads.c:764
        frame 23: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5b248) + 583 at mono-threads-posix.c:92
        frame 24: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 25: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 26: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 13: tid = 0x1e190a8, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5593'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d36b470) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d36b470) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0622738) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 14: tid = 0x1e19492, 0x0543373e libsystem_kernel.dylib`__select + 10, name = 'tid_1c07'
        frame 0: 0x0543373e libsystem_kernel.dylib`__select + 10
        frame 1: 0x00458e30 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_poll(ufds=<unavailable>, nfds=14, timeout=<unavailable>) + 416 at mono-poll.c:83
        frame 2: 0x00399788 com.xamarin.systemtests.watchkitapp.watchkitextension`poll_event_wait(callback=(com.xamarin.systemtests.watchkitapp.watchkitextension`wait_callback at threadpool-ms-io.c:247), user_data=0x7d27edd0) + 152 at threadpool-ms-io-poll.c:152
        frame 3: 0x00398eb8 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread(data=0x00000000) + 2104 at threadpool-ms-io.c:413
        frame 4: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d27f390) + 723 at threads.c:717
        frame 5: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d27f390) + 34 at threads.c:764
        frame 6: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5c4a8) + 583 at mono-threads-posix.c:92
        frame 7: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 8: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 9: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 15: tid = 0x1e1949d, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_42cf'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2783b0) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2783b0) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0826738) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 16: tid = 0x1e194a2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4337'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2792b0) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2792b0) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb00b4648) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 17: tid = 0x1e194a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5d0b'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d279930) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d279930) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

      thread 18: tid = 0x1e194a4, 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215, name = 'tid_4fa3'
        frame 0: 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215
        frame 1: 0x002c6752 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_chunk_index(chunk=0x7be43200, hp=0x11536384, addr=0x13761be0) + 130 at jit-info.c:200
        frame 2: 0x002c54b2 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_find(table=0x7f29de00, hp=0x11536384, addr=0x13761be0) + 178 at jit-info.c:222
        frame 3: 0x002c5255 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_info_table_find_internal(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                                     P?O???D$\x04\x93\x88", try_aot=1, allow_trampolines=1) + 133 at jit-info.c:293
        frame 4: 0x001bacf6 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find_ext(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                                P?O???D$\x04\x93\x88", allow_trampolines=1, out_domain=0x00000000) + 102 at mini-exceptions.c:1020
        frame 5: 0x001b95d2 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                            P?O???D$\x04\x93\x88", out_domain=0x00000000) + 66 at mini-exceptions.c:1058
        frame 6: 0x001d9b3b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline_inner(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                              P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 5147 at mini-trampolines.c:784
        frame 7: 0x001d5e1b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                        P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 91 at mini-trampolines.c:808
        frame 8: 0x001d5db7 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_magic_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                       P?O???D$\x04\x93\x88", arg=0x7f17d830, tramp=0x00000000) + 103 at mini-trampolines.c:823
        frame 9: 0x11526188

      thread 19: tid = 0x1e194a5, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4717'
        frame 0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
        frame 1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
        frame 2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
        frame 3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 264 at mono-os-mutex.h:134
        frame 4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 63 at mono-coop-mutex.h:107
        frame 5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
        frame 6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
        frame 7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d369d60) + 723 at threads.c:717
        frame 8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d369d60) + 34 at threads.c:764
        frame 9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0a2a738) + 583 at mono-threads-posix.c:92
        frame 10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
        frame 11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
        frame 12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34
This way we can pass pointers to managed objects to the native objects
without the coop GC interfering (since icalls won't automatically
switch to "gc safe" mode).
As far as I can tell there are no memory warnings on watchOS,
but I can't find any documentation saying that either.
Removes one usage of ObjectWrapper, since we don't actually need
the return value, we just need to know if an object exists.
Since MONO_ASSERT_GC_SAFE asserts when executed on a detached thread,
and yet it's clearly safe for the GC to run when a thread is detached.
It's entirely possible to call xamarin_invoke_trampoline on a
thread we've never heard about before.
commit mono/mono@e4d33f7
Author: Rolf Bjarne Kvinge <rolf@xamarin.com>
Date:   Wed May 18 14:21:23 2016 +0200

    [System] Throw PlatformNotSupportedException if NetworkInformation.NetworkChange is used on watchOS. (xamarin#3010)

    NetworkInformation.NetworkChange requires the SystemConfiguration framework,
    which isn't available on watchOS.
commit xamarin/maccore@ffd3181
Author: Rolf Bjarne Kvinge <rolf@xamarin.com>
Date:   Thu May 19 11:28:48 2016 +0200

    [xharness] Use the tests from the watch-mono repo for watchOS BCL test projects.
This prevents the watch from getting mightily confused when re-installing
watch apps/extensions.

Not having a CFBundleShortVersionString would cause the following:

* Build & install & run would work fine the first time.
* The second build & install would confuse the watch so that the
  app wouldn't launch. Removing the app and reinstalling wouldn't
  work; the potential options would be to either reboot the device,
  or add a CFBundleShortVersionString to the Info.plists and install
  that build twice.
@rolfbjarne rolfbjarne force-pushed the coop branch 2 times, most recently from 8463325 to e146402 Compare May 26, 2016 15:48
@rolfbjarne
Copy link
Owner

Closing since this is in master now.

@rolfbjarne rolfbjarne closed this Jun 2, 2016
rolfbjarne pushed a commit that referenced this pull request Aug 4, 2016
[xharness] Get new mlaunch for beta 4.
rolfbjarne pushed a commit that referenced this pull request Dec 21, 2016
* [msbuild] Don't rewrite embedded.mobileprovision or archived-expanded-entitlements.xcent

This patch prevents those 2 files from being rewritten in
cases where the contents would not change from what was
already there previously.

This is a partial fix for https://bugzilla.xamarin.com/show_bug.cgi?id=49097

* [msbuild] Re-enabled the RebuildExecutable_NoModifications unit test

With the fixes to EmbedProvisioningProfile and CompileEntitlements,
this unit test now passes.
rolfbjarne pushed a commit that referenced this pull request Jan 11, 2017
…tentially other framework assemblies) (xamarin#1011)

	Target _UnpackLibraryResources:
	Task "UnpackLibraryResources"
		Using task UnpackLibraryResources from Xamarin.MacDev.Tasks.UnpackLibraryResources, Xamarin.MacDev.Tasks, Version=1.0.6128.15885, Culture=neutral, PublicKeyToken=null
		UnpackLibraryResources Task
		  Prefix: monotouch
		  IntermediateOutputPath: obj/iPhone/Debug/
		  NoOverwrite:
		    obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib
		    obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/Info.plist
		    obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib
		    obj/iPhone/Debug/ibtool-link/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib
		    obj/iPhone/Debug/ibtool-link/Main.storyboardc/Info.plist
		    obj/iPhone/Debug/ibtool-link/Main.storyboardc/UIViewController-BYZ-38-t0r.nib
		  ReferencedLibraries:
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll
		    /Users/poupou/Downloads/LinkingTest-2/RMSDKWrapper/bin/Debug//RMSDKWrapper.dll
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
		    /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
		  Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll
		  Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll
		  Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll
		  Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll
		  Inspecting assembly: /Users/poupou/Downloads/LinkingTest-2/RMSDKWrapper/bin/Debug//RMSDKWrapper.dll
		  Inspecting assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
		  Inspecting assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
	Done executing task "UnpackLibraryResources"
	Done building target "_UnpackLibraryResources" in project "/Users/poupou/Downloads/LinkingTest-2/LinkingTest/LinkingTest.csproj".

The above log excerpt shows two issues:

1. mscorlib.dll is needlessly inspected as it's **not** considered a
   "framework" assembly.

   The current check was checking *how* it was resolved and not *where*
   it was resolved to. The later is the most important as it's possible
   for other assemblies to have direct paths references and we do not
   want to process them.

   This is fixed by comparing each assembly path with the (now) provided
   `TargetFrameworkDirectory`

2. mscorlib.dll is inspected twice

   That's because it's present two times in the task's input. That issue
   is upstream (not sure why) of the current task but it makes #1 twice
   as costly. The fix for #1 indirectly fix that too.

Future
------

It's worth investigating to move that logic into `mtouch`. The later must
already load all assemblies and is in charge of removing other embedded
data (e.g. native code from bindings) from the assemblies (so they are not
shipped both inside and outside the .dll in the final .app). This makes
this task seems extraneous work.

Considering that my current test case, `RMSDKWrapper.dll`, is 1.3GB in
size it's easy to see that the extra load (which has nothing to be
extracted wrt resources*) is quite visible in build time.

>  3268.201 ms  UnpackLibraryResources                                  1 calls

* it has for bindings but that's already handled by mtouch
rolfbjarne pushed a commit that referenced this pull request Jan 18, 2017
…xamarin#1513)

TL&DR: This is *how* it should be done and tested, it's not complete
(single, simple case) nor the most interesting case ;-)

The trick is to make sure each case is covered by tests so a mono
_bump_ won't give us a BCL that does not conform to what the linker
expect.

What's the impact ?

1. There is the expected reduction of metadata in mscorlib. Since both
   methods don't call other API there's no indirect effect (removal).

--- before	2017-01-15 11:12:44.000000000 -0500
+++ after	2017-01-15 11:12:56.000000000 -0500
@@ -13166,9 +13166,6 @@
 System.Void System.Security.SecurityException::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
 System.Void System.Security.SecurityException::.ctor(System.String)
 System.Void System.Security.SecurityException::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
-System.Boolean System.Security.SecurityManager::CheckElevatedPermissions()
-System.Security.SecurityManager
-System.Void System.Security.SecurityManager::EnsureElevatedPermissions()
 System.Security.SecurityRulesAttribute
 System.Security.SecurityRuleSet System.Security.SecurityRulesAttribute::m_ruleSet
 System.Void System.Security.SecurityRulesAttribute::.ctor(System.Security.SecurityRuleSet)

2. There is no visible size change (even with #1) in mscorlib.dll due to
   padding (compiler /filealign)

   mscorlib.dll                793,600      793,600            0       0.00 %

3. there's a *very* small reduction of mscorlib.*.aotdata size

   mscorlib.armv7.aotdata      717,264      717,216          -48      -0.01 %
   mscorlib.arm64.aotdata      712,840      712,704         -136      -0.02 %

   AOT data *.aotdata        6,460,064    6,459,880         -184       0.00 %

4. there's no change in executable size - normal as the AOT compiler has
   _likely_ already doing the same optimization (before this commit)

   Executable               29,270,272   29,270,272            0       0.00 %

Full comparison: https://gist.github.com/spouliot/0464c8fa3a92b6486dfd90595d9eb718
rolfbjarne added a commit that referenced this pull request Feb 5, 2018
Fixes these test failures:

    1) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("inline-runtime-arch")
    The warning 'MM0132: Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
    	Message #1 did not match:
    		actual:   'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
    	Message #2 did not match:
    		actual:   'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'

    2) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("foo")
    The warning 'MM0132: Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
    	Message #1 did not match:
    		actual:   'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
    	Message #2 did not match:
    		actual:   'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
rolfbjarne added a commit that referenced this pull request Feb 5, 2018
…better) behavior.

Fixes this test failure:

    1) Failed : Xamarin.Registrar.GenericType_WithInvalidParameterTypes
    The error 'MT4136: The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)'' was not found in the output:
    	Message #1 did not match:
    		actual:   'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<Foundation.NSObject>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''
    		expected: 'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''
rolfbjarne added a commit that referenced this pull request Feb 7, 2018
…re. (xamarin#3391)

* [linker] Optimize calls to BlockLiteral.SetupBlock to inject the block signature.

Optimize calls to BlockLiteral.SetupBlock[Unsafe] to calculate the block
signature at build time, and inject it into the call site.

This makes block invocations 10-15x faster (I've added tests that asserts at
least an 8x increase).

It's also required in order to be able to remove the dynamic registrar code in
the future (since calculating the block signature at runtime requires the
dynamic registrar).

* [mtouch/mmp] Add support for reporting errors/warnings that point to the code line causing the error/warning.

Add support for reporting errors/warnings that point to the code line causing
the error/warning by adding ErrorHelper overloads that take the exact
instruction to report (previously we defaulted to the first line/instruction
in a method).

* [tests] Add support for asserting filename/linenumber in warning messages.

* Make all methods that manually create BlockLiterals optimizable.

* [tests] Create a BaseOptimizeGeneratedCodeTest test that's included in both XI's and XM's link all test.

* [tests] Add link all test (for both XI and XM) to test the BlockLiteral.SetupBlock optimization.

* [tests] Add mtouch/mmp tests for the BlockLiteral.SetupBlock optimization.

* [tests][linker] Make the base test class abstract, so tests in the base class aren't executed twice.

* [tests][linker] Don't execute linkall-only tests in linksdk.

The optimization tests only apply when the test assembly is linked, and that
only happens in linkall, so exclude those tests in linksdk.

* [tests][mmptest] Update test according to mmp changes.

Fixes these test failures:

    1) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("inline-runtime-arch")
    The warning 'MM0132: Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
    	Message #1 did not match:
    		actual:   'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
    	Message #2 did not match:
    		actual:   'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'

    2) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("foo")
    The warning 'MM0132: Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
    	Message #1 did not match:
    		actual:   'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
    	Message #2 did not match:
    		actual:   'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
    		expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'

* [tests][linker] Fix typo.

Fixes this test failure:

    1) SetupBlock_CustomDelegate (Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlock_CustomDelegate)
         Counter
      Expected: 1
      But was:  2

* [registrar] Minor adjustment to error message to match previous (and better) behavior.

Fixes this test failure:

    1) Failed : Xamarin.Registrar.GenericType_WithInvalidParameterTypes
    The error 'MT4136: The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)'' was not found in the output:
    	Message #1 did not match:
    		actual:   'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<Foundation.NSObject>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''
    		expected: 'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''

* [docs] mmp shows MM errors/warnings.

* [docs] Improve according to reviews.

* [tests] Fix merge failure causing test duplication.
rolfbjarne added a commit that referenced this pull request Mar 2, 2018
…rar optimization until after checking the linker settings.

Fixes this test failure:

1) Failed : Xamarin.MTouch.MT0113_linker
The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
	Message #1 did not match:
		actual:   'Native code sharing has been disabled for the extension 'testServiceExtension' because the remove-dynamic-registrar optimization differ between the container app (default) and the extension (false).'
		expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'

which happens because:

* Removing the dynamic registrar requires the linker, so removal of the dynamic registrar is disabled if the linker is not disabled
* This results in the app and appex having different values for the remove-dynamic-registrar option
* Thus the error message.

Technically either error is correct, but I prefer the previous one (about the
linker), because it directly assigns blame (the linker setting). Figuring out
what has to change (the linker setting) when the error message complains about
an optimization is not so straight forward for users.
rolfbjarne added a commit that referenced this pull request Mar 5, 2018
…rar optimization until after checking the linker settings. (xamarin#3643)

Fixes this test failure:

1) Failed : Xamarin.MTouch.MT0113_linker
The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
	Message #1 did not match:
		actual:   'Native code sharing has been disabled for the extension 'testServiceExtension' because the remove-dynamic-registrar optimization differ between the container app (default) and the extension (false).'
		expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'

which happens because:

* Removing the dynamic registrar requires the linker, so removal of the dynamic registrar is disabled if the linker is not disabled
* This results in the app and appex having different values for the remove-dynamic-registrar option
* Thus the error message.

Technically either error is correct, but I prefer the previous one (about the
linker), because it directly assigns blame (the linker setting). Figuring out
what has to change (the linker setting) when the error message complains about
an optimization is not so straight forward for users.
rolfbjarne added a commit that referenced this pull request Mar 5, 2018
…rar optimization until after checking the linker settings. (xamarin#3643)

Fixes this test failure:

1) Failed : Xamarin.MTouch.MT0113_linker
The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
	Message #1 did not match:
		actual:   'Native code sharing has been disabled for the extension 'testServiceExtension' because the remove-dynamic-registrar optimization differ between the container app (default) and the extension (false).'
		expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'

which happens because:

* Removing the dynamic registrar requires the linker, so removal of the dynamic registrar is disabled if the linker is not disabled
* This results in the app and appex having different values for the remove-dynamic-registrar option
* Thus the error message.

Technically either error is correct, but I prefer the previous one (about the
linker), because it directly assigns blame (the linker setting). Figuring out
what has to change (the linker setting) when the error message complains about
an optimization is not so straight forward for users.
rolfbjarne added a commit that referenced this pull request Mar 9, 2018
…rar optimization until after checking the linker settings. (xamarin#3643) (xamarin#3661)

Fixes this test failure:

1) Failed : Xamarin.MTouch.MT0113_linker
The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
	Message #1 did not match:
		actual:   'Native code sharing has been disabled for the extension 'testServiceExtension' because the remove-dynamic-registrar optimization differ between the container app (default) and the extension (false).'
		expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'

which happens because:

* Removing the dynamic registrar requires the linker, so removal of the dynamic registrar is disabled if the linker is not disabled
* This results in the app and appex having different values for the remove-dynamic-registrar option
* Thus the error message.

Technically either error is correct, but I prefer the previous one (about the
linker), because it directly assigns blame (the linker setting). Figuring out
what has to change (the linker setting) when the error message complains about
an optimization is not so straight forward for users.
rolfbjarne added a commit that referenced this pull request Mar 14, 2018
The MSBuild tasks will codesign an executable if the executable's timestamp is
later than `_CodeSignature/CodeResources`'s timestamp (or if
`_CodeSignature/CodeResources` doesn't exist).

Unfortunately, the codesign executable modifies both of those files, and the
executable last. This means that even just after running codesign, the
executable's timestamp might be later than `_CodeSignature/CodeResources`'s
timestamp (due to HFS+'s one-second timestamp resolution, this might happen
all within the same second, which means that this is a random issue: the
problem only occurs if the executable was modified at least a second later
than `_CodeSignature/CodeResources`.)

So make sure to touch `_CodeSignature/CodeResources` after running codesign,
so that the next time a build occurs (with no modifications), we don't resign
needlessly.

Fixes this (random) test failure when running the MSBuild tests:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.RebuildExecutable_NoModifications
         #1: ../MySingleView/bin/iPhoneSimulator/Debug/MySingleView.app/MySingleView
      Expected: 2017-11-30 10:04:20.000
      But was:  2017-11-30 10:04:22.000

Fixes xamarin/maccore#592.
rolfbjarne added a commit that referenced this pull request Mar 20, 2018
The MSBuild tasks will codesign an executable if the executable's timestamp is
later than `_CodeSignature/CodeResources`'s timestamp (or if
`_CodeSignature/CodeResources` doesn't exist).

Unfortunately, the codesign executable modifies both of those files, and the
executable last. This means that even just after running codesign, the
executable's timestamp might be later than `_CodeSignature/CodeResources`'s
timestamp (due to HFS+'s one-second timestamp resolution, this might happen
all within the same second, which means that this is a random issue: the
problem only occurs if the executable was modified at least a second later
than `_CodeSignature/CodeResources`.)

So make sure to touch `_CodeSignature/CodeResources` after running codesign,
so that the next time a build occurs (with no modifications), we don't resign
needlessly.

Fixes this (random) test failure when running the MSBuild tests:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.RebuildExecutable_NoModifications
         #1: ../MySingleView/bin/iPhoneSimulator/Debug/MySingleView.app/MySingleView
      Expected: 2017-11-30 10:04:20.000
      But was:  2017-11-30 10:04:22.000

Fixes xamarin/maccore#592.
rolfbjarne pushed a commit that referenced this pull request Jun 15, 2018
…amarin#4231)

The MSBuild tasks will codesign an executable if the executable's timestamp is
later than `_CodeSignature/CodeResources`'s timestamp (or if
`_CodeSignature/CodeResources` doesn't exist).

Unfortunately, the codesign executable modifies both of those files, and the
executable last. This means that even just after running codesign, the
executable's timestamp might be later than `_CodeSignature/CodeResources`'s
timestamp (due to HFS+'s one-second timestamp resolution, this might happen
all within the same second, which means that this is a random issue: the
problem only occurs if the executable was modified at least a second later
than `_CodeSignature/CodeResources`.)

So make sure to touch `_CodeSignature/CodeResources` after running codesign,
so that the next time a build occurs (with no modifications), we don't resign
needlessly.

Fixes this (random) test failure when running the MSBuild tests:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.RebuildExecutable_NoModifications
         #1: ../MySingleView/bin/iPhoneSimulator/Debug/MySingleView.app/MySingleView
      Expected: 2017-11-30 10:04:20.000
      But was:  2017-11-30 10:04:22.000

Fixes https://github.com/xamarin/maccore/issues/592.
rolfbjarne added a commit that referenced this pull request Mar 19, 2019
rolfbjarne added a commit that referenced this pull request Mar 28, 2019
rolfbjarne pushed a commit that referenced this pull request May 10, 2019
xamarin#6011)

* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes mono/mono#13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
rolfbjarne pushed a commit that referenced this pull request May 20, 2019
…projects. (xamarin#6035)

* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes mono/mono#13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
rolfbjarne pushed a commit that referenced this pull request Aug 26, 2019
…#6821)

We were getting:

```
Xamarin.MTouch.LinkerWarnings: The warning 'MT5203: Native linking warning: warning: ignoring file /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/test-libraries/.libs/ios/libtest.x86_64.a, building for iOS Simulator-i386 but attempting to link with file built for unknown-archive' was not found in the output:
    Message #1 did not match:
        actual: 'Native linking warning: warning: ignoring file /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/test-libraries/.libs/ios/libtest.x86_64.a, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64'
        expected: 'Native linking warning: warning: ignoring file /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/test-libraries/.libs/ios/libtest.x86_64.a, building for iOS Simulator-i386 but attempting to link with file built for unknown-archive'
```
rolfbjarne pushed a commit that referenced this pull request Sep 25, 2019
xamarin#7075)

I get this otherwise on the watch4 in debug mode (with interp):

```
Process 1255 stopped
* thread #1, name = 'tid_303', queue = 'com.apple.main-thread', stop reason = EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=80 MB, unused=0x0)
    frame #0: 0x1e185ae8 CoreGraphics`x_malloc + 44
CoreGraphics`x_malloc:
->  0x1e185ae8 <+44>: str    w19, [x0], #0x10
    0x1e185aec <+48>: ldp    x29, x30, [sp, #0x10]
    0x1e185af0 <+52>: ldp    x20, x19, [sp], #0x20
    0x1e185af4 <+56>: ret
Target 0: (monotouchtest) stopped.
```
rolfbjarne added a commit that referenced this pull request Aug 24, 2020
…s in .NET

A System.Drawing.Point test fails because it tests GetHashCode, which returns
a different value in .NET. None of the System.Drawing tests actually test any
of our code (when using .NET), so the fix is to just not include the
System.Drawing tests in the first place.

Fixes this test failure:

    MonoTests.System.Drawing.PointTest
        [FAIL] GetHashCodeTest :   #1
            Expected: 32
            But was:  1527927283
                at MonoTests.System.Drawing.PointTest.GetHashCodeTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs:line 198
rolfbjarne added a commit that referenced this pull request Aug 24, 2020
…s in .NET (xamarin#9464)

A System.Drawing.Point test fails because it tests GetHashCode, which returns
a different value in .NET. None of the System.Drawing tests actually test any
of our code (when using .NET), so the fix is to just not include the
System.Drawing tests in the first place.

Fixes this test failure:

    MonoTests.System.Drawing.PointTest
        [FAIL] GetHashCodeTest :   #1
            Expected: 32
            But was:  1527927283
                at MonoTests.System.Drawing.PointTest.GetHashCodeTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs:line 198
rolfbjarne added a commit that referenced this pull request Aug 25, 2020
…r the message changed.

This regressed here: d7ab847

Fixes this failure:

    Xamarin.MTouch.MT0113_linker:
    The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
        Message #1 did not match:
            actual: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (Full).'
            expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'
rolfbjarne added a commit that referenced this pull request Aug 25, 2020
…r the message changed. (xamarin#9485)

This regressed here: d7ab847

Fixes this failure:

    Xamarin.MTouch.MT0113_linker:
    The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
        Message #1 did not match:
            actual: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (Full).'
            expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'
rolfbjarne added a commit that referenced this pull request Aug 27, 2020
…line.

Fixes this startup crash in link all:

    2020-08-26 19:56:03.936330+0200 link all[45665:6121665] Could not register the assembly 'link all': ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.get_Signature()
       at Registrar.Registrar.ObjCMethod.get_Trampoline()
       at Registrar.DynamicRegistrar.RegisterMethod(ObjCMethod method)
       at Registrar.DynamicRegistrar.OnRegisterType(ObjCType type)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)
       at Registrar.Registrar.RegisterAssembly(Assembly assembly)
    2020-08-26 19:56:03.939327+0200 link all[45665:6121665] System.AggregateException: One or more errors occurred. (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.)
     ---> ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)
       --- End of inner exception stack trace ---
     ---> (Inner Exception #1) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.VerifyInSdk(List`1& exceptions, ObjCMethod method)
       at Registrar.Registrar.ObjCType.Add(ObjCMethod method, List`1& exceptions)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)<---

     ---> (Inner Exception #2) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)<---

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x10d57eb0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    	0x10d52b437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    	0x10d57e365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
    	0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x10d32478f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
    	0x10d5eef68 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
    	0x10d52ade0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10d5296c1 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10d579582 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x10d91b5b0 - Unknown
    	0x10d3244eb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
    	0x10d324367 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
    	0x10d336851 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_main
    	0x10d217ced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/link all : main
    	0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
rolfbjarne added a commit that referenced this pull request Aug 28, 2020
…line. (xamarin#9537)

This also means:

* Adding the ExceptionalSubStep step to the build.
* Adding a few workarounds for missing/different linker API.

This fixes this startup crash in link all:

    2020-08-26 19:56:03.936330+0200 link all[45665:6121665] Could not register the assembly 'link all': ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.get_Signature()
       at Registrar.Registrar.ObjCMethod.get_Trampoline()
       at Registrar.DynamicRegistrar.RegisterMethod(ObjCMethod method)
       at Registrar.DynamicRegistrar.OnRegisterType(ObjCType type)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)
       at Registrar.Registrar.RegisterAssembly(Assembly assembly)
    2020-08-26 19:56:03.939327+0200 link all[45665:6121665] System.AggregateException: One or more errors occurred. (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.)
     ---> ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)
       --- End of inner exception stack trace ---
     ---> (Inner Exception #1) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.VerifyInSdk(List`1& exceptions, ObjCMethod method)
       at Registrar.Registrar.ObjCType.Add(ObjCMethod method, List`1& exceptions)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)<---

     ---> (Inner Exception #2) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)<---

    =================================================================
      Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
      Native stacktrace:
    =================================================================
      0x10d57eb0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
      0x10d52b437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
      0x10d57e365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
      0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
      0x0 - Unknown
      0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
      0x10d32478f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
      0x10d5eef68 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
      0x10d52ade0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
      0x10d5296c1 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
      0x10d579582 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
      0x10d91b5b0 - Unknown
      0x10d3244eb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
      0x10d324367 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
      0x10d336851 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_main
      0x10d217ced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/link all : main
      0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
rolfbjarne pushed a commit that referenced this pull request Jan 12, 2021
…amarin#10309)

**Example #1.** Signing a framework binary is the **same** thing as
signing the framework directory.

```
$ codesign -v --force --timestamp=none --sign - bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework/lame
bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework/lame: replacing existing signature
bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework/lame: signed bundle with Mach-O thin (arm64) [io.sourceforge.lame]

$ codesign -v --force --timestamp=none --sign - bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework
bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework: replacing existing signature
bin/iPhone/Release/xcf_ios.app//Frameworks/lame.framework: signed bundle with Mach-O thin (arm64) [io.sourceforge.lame]
```

Nice right ? Pretty much until...

**Example #2.** Signing a framework binary is **NOT** the **same** thing
as signing the framework directory.

```
$ codesign -v --force --timestamp=none --sign - bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework/flac
bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework/flac: replacing existing signature
bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework/flac: signed Mach-O thin (arm64) [flac-55554944583d2f02282c33d8bfed082daa857e30]

$ codesign -v --force --timestamp=none --sign - bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework
bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework: replacing existing signature
bin/iPhone/Release/xcf_ios.app//Frameworks/flac.framework: signed bundle with Mach-O thin (arm64) [org.xiph.flac]
```

In this case signing the binary `flac` does not produce the
`_CodeSignature` directory and fails our msbuild Codesign task

The fix is to detect if we're signing a framework like `A.framework/A`
and change this to sign `A.framework` as this will always work.
rolfbjarne added a commit that referenced this pull request May 4, 2021
Next failure is:

> monotouchtest[8307:20722735] Xamarin.Mac: The method mono_runtime_invoke has not been implemented for CoreCLR.

```
* frame #0: 0x00007fff2059b462 libsystem_kernel.dylib`__pthread_kill + 10
  frame #1: 0x00007fff205c9610 libsystem_pthread.dylib`pthread_kill + 263
  frame #2: 0x00007fff2051c720 libsystem_c.dylib`abort + 120
  frame #3: 0x0000000100044ab8 monotouchtest`xamarin_assertion_message(msg="The method %s has not been implemented for CoreCLR.\n") at runtime.m:1474:2
  frame #4: 0x0000000100013f0d monotouchtest`mono_runtime_invoke(method=0x0000000100e5afe0, obj=0x0000000100e5afd0, params=0x00007ffeefbfdd28, exc=0x0000000000000000) at mono-runtime.m:1946:2
  frame #5: 0x00000001000a1a69 monotouchtest`native_to_managed_trampoline_30(self=0x0000000100e5bad0, _cmd="xamarinApplySelector", managed_method_ptr=0x00000001001d5028, token_ref=12113) at Microsoft.macOS.registrar.coreclr.x86_64.m:1371:2
  frame xamarin#6: 0x00000001000a1bcc monotouchtest`-[__MonoMac_NSActionDispatcher xamarinApplySelector](self=0x0000000100e5bad0, _cmd="xamarinApplySelector") at Microsoft.macOS.registrar.coreclr.x86_64.m:38540:3
  frame xamarin#7: 0x00007fff2143bba9 Foundation`-[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 935
  frame xamarin#8: 0x00007fff2143b6a1 Foundation`-[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 124
  frame xamarin#9: 0x000000010005cc89 monotouchtest`xamarin_dyn_objc_msgSend at trampolines-x86_64-objc_msgSend.s:15
```
rolfbjarne added a commit that referenced this pull request May 4, 2021
Next failure is:

> monotouchtest[8307:20722735] Xamarin.Mac: The method mono_runtime_invoke has not been implemented for CoreCLR.

```
* frame #0: 0x00007fff2059b462 libsystem_kernel.dylib`__pthread_kill + 10
  frame #1: 0x00007fff205c9610 libsystem_pthread.dylib`pthread_kill + 263
  frame #2: 0x00007fff2051c720 libsystem_c.dylib`abort + 120
  frame #3: 0x0000000100044ab8 monotouchtest`xamarin_assertion_message(msg="The method %s has not been implemented for CoreCLR.\n") at runtime.m:1474:2
  frame #4: 0x0000000100013f0d monotouchtest`mono_runtime_invoke(method=0x0000000100e5afe0, obj=0x0000000100e5afd0, params=0x00007ffeefbfdd28, exc=0x0000000000000000) at mono-runtime.m:1946:2
  frame #5: 0x00000001000a1a69 monotouchtest`native_to_managed_trampoline_30(self=0x0000000100e5bad0, _cmd="xamarinApplySelector", managed_method_ptr=0x00000001001d5028, token_ref=12113) at Microsoft.macOS.registrar.coreclr.x86_64.m:1371:2
  frame xamarin#6: 0x00000001000a1bcc monotouchtest`-[__MonoMac_NSActionDispatcher xamarinApplySelector](self=0x0000000100e5bad0, _cmd="xamarinApplySelector") at Microsoft.macOS.registrar.coreclr.x86_64.m:38540:3
  frame xamarin#7: 0x00007fff2143bba9 Foundation`-[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 935
  frame xamarin#8: 0x00007fff2143b6a1 Foundation`-[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 124
  frame xamarin#9: 0x000000010005cc89 monotouchtest`xamarin_dyn_objc_msgSend at trampolines-x86_64-objc_msgSend.s:15
```
rolfbjarne added a commit that referenced this pull request Mar 6, 2024
We've recently had a few test failures like this:

    MonoTests.System.Net.Http.MessageHandlerTest.GHIssue16339
     	[FAIL] GHIssue16339() :   IsSuccessStatusCode #1
       Expected: True
       But was:  False

which doesn't provide much info into what went wrong.

It turns out this particular assert for IsSuccessStatusCode is redundant,
because we assert on the exact StatusCode a bit later, and if that assert
fails, we'll know a bit more.

So just remove this redundant assert for IsSuccessStatusCode.
rolfbjarne added a commit that referenced this pull request Mar 7, 2024
We've recently had a few test failures like this:

    MonoTests.System.Net.Http.MessageHandlerTest.GHIssue16339
     	[FAIL] GHIssue16339() :   IsSuccessStatusCode #1
       Expected: True
       But was:  False

which doesn't provide much info into what went wrong.

It turns out this particular assert for IsSuccessStatusCode is redundant,
because we assert on the exact StatusCode a bit later, and if that assert
fails, we'll know a bit more.

So just remove this redundant assert for IsSuccessStatusCode.
rolfbjarne added a commit that referenced this pull request Apr 10, 2024
…I and have a bad network.

Fixes this test failure:

    MonoTests.System.Net.Http.MessageHandlerTest.GHIssue16339
    	[FAIL] GHIssue16339() :   ReasonPhrase #1
      Expected string length 2 but was 11. Strings differ at index 0.
      Expected: "OK"
      But was:  "Bad Gateway"
rolfbjarne added a commit that referenced this pull request Apr 12, 2024
…I and have a bad network. (xamarin#20416)

Fixes this test failure:

    MonoTests.System.Net.Http.MessageHandlerTest.GHIssue16339
    	[FAIL] GHIssue16339() :   ReasonPhrase #1
      Expected string length 2 but was 11. Strings differ at index 0.
      Expected: "OK"
      But was:  "Bad Gateway"
rolfbjarne added a commit that referenced this pull request Aug 13, 2024
… order. (xamarin#20889)

The CustomizedCodeSigning test asserts that a certain condition shows a
particular error message from codesign.

There are multiple files in the app bundle that can trigger this particular
message, so change the logic to not assert on a particular file, instead use
assert on the remained of the error message.

Fixes this random test failure:

    Xamarin.Tests.DotNetProjectTest.CustomizedCodeSigning(iOS,"ios-arm64"): Failure when comparing error messages:
        Unexpected error message #0:
            Expected: /usr/bin/codesign exited with code 1:\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Diagnostics.DiagnosticSource.dll
            Actual: /usr/bin/codesign exited with code 1:\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
        Unexpected error message #1:
            Expected: Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Diagnostics.DiagnosticSource.dll
            Actual: Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
        All errors:
            /usr/bin/codesign exited with code 1:
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all
                In subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
                        Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all
                In subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants