From 888449283997708556bfe01801283ed7c1e3e6da Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Thu, 18 May 2017 15:56:54 -0700 Subject: [PATCH] [mini] Remove assert and document reason it can't be used. --- mono/mini/memory-access.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mono/mini/memory-access.c b/mono/mini/memory-access.c index 57b7c92b19c..57b07ed074a 100644 --- a/mono/mini/memory-access.c +++ b/mono/mini/memory-access.c @@ -344,7 +344,12 @@ mini_emit_memory_copy_internal (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoInst *memcpy_ins = NULL; g_assert (klass); - g_assert (!(native && klass->has_references)); + /* + Fun fact about @native. It's false that @klass will have no ref when @native is true. + This happens in pinvoke2. What goes is that marshal.c uses CEE_MONO_LDOBJNATIVE and pass klass. + The actual stuff being copied will have no refs, but @klass might. + This means we can't assert !(klass->has_references && native). + */ if (cfg->gshared) klass = mono_class_from_mono_type (mini_get_underlying_type (&klass->byval_arg)); -- 2.25.1