[runtime] Add MonoError to mono_remote_class
[mono.git] / mono / metadata / sgen-mono.c
index 8f08eef36e6b7ebd5c703ade6bdf82a864c9b799..8421b903ba6f967366bba0f2d7c7b337510ac1ee 100644 (file)
@@ -1198,14 +1198,12 @@ create_allocator (int atype, gboolean slowpath)
                /* catch */
                clause->flags = MONO_EXCEPTION_CLAUSE_NONE;
                clause->try_len = mono_mb_get_pos (mb) - clause->try_offset;
-               clause->data.catch_class = mono_class_from_name (mono_defaults.corlib,
+               clause->data.catch_class = mono_class_load_from_name (mono_defaults.corlib,
                                "System", "OverflowException");
-               g_assert (clause->data.catch_class);
                clause->handler_offset = mono_mb_get_label (mb);
 
-               oom_exc_class = mono_class_from_name (mono_defaults.corlib,
+               oom_exc_class = mono_class_load_from_name (mono_defaults.corlib,
                                "System", "OutOfMemoryException");
-               g_assert (oom_exc_class);
                ctor = mono_class_get_method_from_name (oom_exc_class, ".ctor", 0);
                g_assert (ctor);
 
@@ -1390,12 +1388,13 @@ create_allocator (int atype, gboolean slowpath)
        info->d.alloc.gc_name = "sgen";
        info->d.alloc.alloc_type = atype;
 
-       res = mono_mb_create (mb, csig, 8, info);
-       mono_mb_free (mb);
 #ifndef DISABLE_JIT
-       mono_method_get_header (res)->init_locals = FALSE;
+       mb->init_locals = FALSE;
 #endif
 
+       res = mono_mb_create (mb, csig, 8, info);
+       mono_mb_free (mb);
+
 
        return res;
 }