From 6fb3d16818813b941196c8990069daf36ec0918d Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Thu, 19 Sep 2019 11:14:49 +0200 Subject: [PATCH] [coop] add missing gc_unsafe transition frame #3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3 frame #4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=, args=) at goutput.c:149:2 [opt] frame #5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=, log_level=, format=, args=) at goutput.c:156:10 [opt] frame #6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=, log_level=, format=) at goutput.c:165:2 [opt] frame #7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt] frame #8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt] frame #9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt] frame #10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt] frame #11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt] frame #12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4 frame #13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2 frame #14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4 frame #15: 0x02a64764 monotouchtest`do_icall(frame=, sig=0x17d70bf0, op=, sp=0x19498fa0, ptr=, save_last_error=0) at interp.c:1947:3 [opt] frame #16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt] Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame #17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=, clause_args=, error=) at interp.c:3229:9 [opt] ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame #18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=, clause_args=, error=) at interp.c:3400:4 [opt] ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame #19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=, clause_args=, error=) at interp.c:3325:4 [opt] Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame #20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=, clause_args=, error=) at interp.c:3400:4 [opt] frame #21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt] frame #22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=, params=0x00000000, exc=, error=0x194998b8) at mini-runtime.c:3170:12 [opt] frame #23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt] frame #24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=, obj=, params=, error=) at class-getters.h:24:1 [opt] [artificial] frame #25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt] frame #26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=, this_arg=, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt] frame #27: 0x02a64788 monotouchtest`do_icall(frame=, sig=0x17496978, op=, sp=0x19499d88, ptr=, save_last_error=0) at interp.c:1982:20 [opt] frame #28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt] RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame #29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=, clause_args=, error=) at interp.c:3229:9 [opt] RuntimeMethodInfo::Invoke @ 400701852 "call" || frame #30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=, clause_args=, error=) at interp.c:3400:4 [opt] MethodBase::Invoke @ 400700872 "callvirt.fast" || frame #31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=, clause_args=, error=) at interp.c:3325:4 [opt] --- runtime/runtime.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/runtime.m b/runtime/runtime.m index 19e9e74bfcaf..32379ff72417 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -2361,8 +2361,10 @@ -(void) xamarinSetGCHandle: (int) gc_handle; exc_handle = [[ns_exception userInfo] objectForKey: @"XamarinManagedExceptionHandle"]; if (exc_handle != NULL) { int handle = [exc_handle getHandle]; + MONO_ENTER_GC_UNSAFE; MonoObject *exc = mono_gchandle_get_target (handle); mono_runtime_set_pending_exception ((MonoException *) exc, false); + MONO_EXIT_GC_UNSAFE; } else { int handle = xamarin_create_ns_exception (ns_exception, &exception_gchandle); if (exception_gchandle != 0) {