From: monojenkins Date: Wed, 1 Apr 2020 20:01:28 +0000 (-0400) Subject: Ensure generic parameter constraint type is included when building image (#34346) X-Git-Tag: submit/tizen/20210909.063632~8811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf4b572e88ec5130473a50b8f3bc1873fc2e5a65;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Ensure generic parameter constraint type is included when building image (#34346) sets. This fixes: https://issuetracker.unity3d.com/issues/editor-crash-when-entering-and-exiting-playmode-for-a-few-times-with-microsoft-maps-sdk @joncham and I were working on this we hit the two asserts that I've removed. We were wondering if they were still needed? Co-authored-by: UnityAlex --- diff --git a/src/mono/mono/metadata/metadata.c b/src/mono/mono/metadata/metadata.c index 9ce5150..5734b9f 100644 --- a/src/mono/mono/metadata/metadata.c +++ b/src/mono/mono/metadata/metadata.c @@ -2570,7 +2570,13 @@ retry: return signature_in_image (type->data.method, image); case MONO_TYPE_VAR: case MONO_TYPE_MVAR: - return image == mono_get_image_for_generic_param (type->data.generic_param); + if (image == mono_get_image_for_generic_param (type->data.generic_param)) + return TRUE; + else if (type->data.generic_param->gshared_constraint) { + type = type->data.generic_param->gshared_constraint; + goto retry; + } + return FALSE; default: /* At this point, we should've avoided all potential allocations in mono_class_from_mono_type_internal () */ return image == m_class_get_image (mono_class_from_mono_type_internal (type)); @@ -3055,6 +3061,9 @@ retry: { MonoImage *image = mono_get_image_for_generic_param (type->data.generic_param); add_image (image, data); + type = type->data.generic_param->gshared_constraint; + if (type) + goto retry; break; } case MONO_TYPE_CLASS: