diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index b125d2664abee4..d540cec6a9780f 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -4644,7 +4644,12 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi } interp_ins_set_dreg (td->last_ins, td->sp [-1].var); } else { - if (G_UNLIKELY (m_field_is_from_update (field)) && (mt == MINT_TYPE_VT || mt == MINT_TYPE_O)) { + // Fields from hotreload update and fields from collectible assemblies are not + // stored inside fixed gc roots but rather in other objects. This means that + // storing into these fields requires write barriers. + if ((mt == MINT_TYPE_VT || mt == MINT_TYPE_O) && + (m_field_is_from_update (field) || + mono_image_get_alc (m_class_get_image (m_field_get_parent (field)))->collectible)) { interp_emit_ldsflda (td, field, error); return_if_nok (error); interp_emit_stobj (td, field_class, TRUE);