+ /* TypeInitializationException only has 1 ctor with 2 args */
+ iter = NULL;
+ while ((method = mono_class_get_methods (klass, &iter))) {
+ if (!strcmp (".ctor", mono_method_get_name (method)) && mono_method_signature (method)->param_count == 2)
+ break;
+ method = NULL;
+ }
+
+ g_assert (method);
+
+ args [0] = mono_string_new (mono_domain_get (), type_name);
+ args [1] = inner;
+
+ exc = mono_object_new (mono_domain_get (), klass);
+ mono_runtime_invoke (method, exc, args, NULL);
+
+ return (MonoException *) exc;
+}
+
+/**
+ * mono_get_exception_synchronization_lock:
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.TypeInitializationException
+ */
+MonoException *
+mono_get_exception_synchronization_lock (const char *msg)
+{
+ return mono_exception_from_name_msg (mono_get_corlib (), "System.Threading", "SynchronizationLockException", msg);
+}
+
+/**
+ * mono_get_exception_cannot_unload_appdomain:
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.CannotUnloadAppDomainException
+ */
+MonoException *
+mono_get_exception_cannot_unload_appdomain (const char *msg)
+{
+ return mono_exception_from_name_msg (mono_get_corlib (), "System", "CannotUnloadAppDomainException", msg);
+}
+
+/**
+ * mono_get_exception_appdomain_unloaded
+ *
+ * Returns: a new instance of the System.AppDomainUnloadedException
+ */
+MonoException *
+mono_get_exception_appdomain_unloaded (void)
+{
+ return mono_exception_from_name (mono_get_corlib (), "System", "AppDomainUnloadedException");
+}
+
+/**
+ * mono_get_exception_bad_image_format:
+ * @msg: an informative message for the user.
+ *
+ * Returns: a new instance of the System.BadImageFormatException
+ */
+MonoException *
+mono_get_exception_bad_image_format (const char *msg)
+{
+ return mono_exception_from_name_msg (mono_get_corlib (), "System", "BadImageFormatException", msg);
+}
+
+/**
+ * mono_get_exception_bad_image_format2:
+ * @msg: an informative message for the user.
+ * @fname: The full name of the file with the invalid image.
+ *
+ * Returns: a new instance of the System.BadImageFormatException
+ */
+MonoException *
+mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname)
+{
+ MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
+
+ return mono_exception_from_name_two_strings (
+ mono_get_corlib (), "System", "BadImageFormatException", s, fname);
+}
+
+/**
+ * mono_get_exception_stack_overflow:
+ *
+ * Returns: a new instance of the System.StackOverflowException
+ */
+MonoException *
+mono_get_exception_stack_overflow (void)
+{
+ return mono_exception_from_name (mono_get_corlib (), "System", "StackOverflowException");
+}
+
+/**
+ * mono_get_exception_reflection_type_load:
+ * @types: an array of types that were defined in the moduled loaded.
+ * @exceptions: an array of exceptions that were thrown during the type loading.
+ *
+ * Returns: a new instance of the System.Reflection.ReflectionTypeLoadException
+ */
+MonoException *
+mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions)
+{
+ MonoClass *klass;
+ gpointer args [2];
+ MonoObject *exc;
+ MonoMethod *method;
+
+ klass = mono_class_from_name (mono_get_corlib (), "System.Reflection", "ReflectionTypeLoadException");
+ g_assert (klass);
+ mono_class_init (klass);
+
+ method = mono_class_get_method_from_name (klass, ".ctor", 2);
+ g_assert (method);
+
+ args [0] = types;
+ args [1] = exceptions;
+
+ exc = mono_object_new (mono_domain_get (), klass);
+ mono_runtime_invoke (method, exc, args, NULL);
+
+ return (MonoException *) exc;
+}