未验证 提交 d2fcb23b 编写于 作者: A Alex Thibodeau 提交者: GitHub

Merge pull request #1342 from Unity-Technologies/unity-master-fix-1274470

Unity master fix case 1274470
...@@ -6833,10 +6833,12 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, ...@@ -6833,10 +6833,12 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
mono_mb_emit_ldloc (mb, conv_arg); mono_mb_emit_ldloc (mb, conv_arg);
break; break;
case MARSHAL_ACTION_CONV_RESULT: case MARSHAL_ACTION_CONV_RESULT: {
/* fixme: we need conversions here */ mono_mb_emit_byte (mb, CEE_POP);
mono_mb_emit_stloc (mb, 3); char *msg = g_strdup_printf ("Cannot marshal 'return value': Invalid managed/unmanaged type combination.");
mono_mb_emit_exception_marshal_directive (mb, msg);
break; break;
}
case MARSHAL_ACTION_MANAGED_CONV_IN: { case MARSHAL_ACTION_MANAGED_CONV_IN: {
MonoClass *eklass; MonoClass *eklass;
......
...@@ -7556,3 +7556,12 @@ mono_test_native_to_managed_exception_rethrow (NativeToManagedExceptionRethrowFu ...@@ -7556,3 +7556,12 @@ mono_test_native_to_managed_exception_rethrow (NativeToManagedExceptionRethrowFu
pthread_join (t, NULL); pthread_join (t, NULL);
} }
#endif #endif
static guint8 static_arr[] = { 1, 2, 3, 4 };
LIBTEST_API guint8*
mono_test_marshal_return_array (void)
{
return static_arr;
}
...@@ -1987,5 +1987,17 @@ public unsafe class Tests { ...@@ -1987,5 +1987,17 @@ public unsafe class Tests {
return 2; return 2;
return 0; return 0;
} }
[DllImport ("libtest", EntryPoint="mono_test_marshal_return_array")]
public static extern int[] mono_test_marshal_return_array ();
public static int test_0_return_array () {
try {
var arr = mono_test_marshal_return_array ();
return 1;
} catch (MarshalDirectiveException) {
return 0;
}
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册