Fix the handling of unresolved pinvoke methods in full-aot mode.
authorZoltan Varga <vargaz@gmail.com>
Thu, 28 Feb 2013 23:22:50 +0000 (00:22 +0100)
committerZoltan Varga <vargaz@gmail.com>
Thu, 28 Feb 2013 23:23:10 +0000 (00:23 +0100)
mono/metadata/marshal.c

index c0a81b341f499345d94144762cce30e754580af5..865aa9270cb6a5767ba3b38120b51b5cc6d3c4fb 100644 (file)
@@ -8636,21 +8636,26 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
 
        mb->method->save_lmf = 1;
 
-#ifndef DISABLE_JIT
        /*
         * In AOT mode and embedding scenarios, it is possible that the icall is not
         * registered in the runtime doing the AOT compilation.
         */
        if (!piinfo->addr && !aot) {
+#ifndef DISABLE_JIT
                mono_mb_emit_exception (mb, exc_class, exc_arg);
+#endif
                csig = signature_dup (method->klass->image, sig);
                csig->pinvoke = 0;
                res = mono_mb_create_and_cache (cache, method,
                                                                                mb, csig, csig->param_count + 16);
                mono_mb_free (mb);
+
+               info = mono_wrapper_info_create (res, WRAPPER_SUBTYPE_NONE);
+               info->d.managed_to_native.method = method;
+               mono_marshal_set_wrapper_info (res, info);
+
                return res;
        }
-#endif
 
        /* internal calls: we simply push all arguments and call the method (no conversions) */
        if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {