From 3e4fd7978f749bff18236e0dd670ee408439f705 Mon Sep 17 00:00:00 2001 From: monojenkins Date: Tue, 31 Mar 2020 12:33:48 -0400 Subject: [PATCH] Wrap mono_gc_init_finalizer_thread() call with now-needed coop GC state transition. (#8248) Starting with https://github.com/mono/mono/pull/16907 , the Mono runtime ends in GC-Safe state (mode) after mono_jit_init_version() is called. The monotouch code did not expect that, and calls mono_gc_init_finalizer_thread() which also tries to enter GC-safe mode. Should fix https://github.com/mono/mono/issues/19372 Co-authored-by: Alexis Christoforides --- runtime/monotouch-main.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/monotouch-main.m b/runtime/monotouch-main.m index 8079fd207eb1..5500808751ca 100644 --- a/runtime/monotouch-main.m +++ b/runtime/monotouch-main.m @@ -203,7 +203,9 @@ - (void) start { // COOP: ? #if defined (__arm__) || defined(__aarch64__) + MONO_ENTER_GC_UNSAFE; mono_gc_init_finalizer_thread (); + MONO_EXIT_GC_UNSAFE; #endif }