+/**
+ * mono_get_exception_thread_state:
+ * @msg: the message to present to the user
+ *
+ * Returns: a new instance of the System.Threading.ThreadStateException
+ */
+MonoException *
+mono_get_exception_thread_state (const char *msg)
+{
+ return mono_exception_from_name_msg (
+ mono_get_corlib (), "System.Threading", "ThreadStateException", msg);
+}
+
+/**
+ * mono_get_exception_io:
+ * @msg: the message to present to the user
+ *
+ * Returns: a new instance of the System.IO.IOException
+ */
+MonoException *
+mono_get_exception_io (const char *msg)
+{
+ return mono_exception_from_name_msg (
+ mono_get_corlib (), "System.IO", "IOException", msg);
+}
+
+/**
+ * mono_get_exception_file_not_found:
+ * @fname: the name of the file not found.
+ *
+ * Returns: a new instance of the System.IO.FileNotFoundException
+ */
+MonoException *
+mono_get_exception_file_not_found (MonoString *fname)
+{
+ return mono_exception_from_name_two_strings (
+ mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname);
+}
+
+/**
+ * mono_get_exception_file_not_found2:
+ * @msg: an informative message for the user.
+ * @fname: the name of the file not found.
+ *
+ * Returns: a new instance of the System.IO.FileNotFoundException
+ */
+MonoException *
+mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
+{
+ MonoString *s = mono_string_new (mono_domain_get (), msg);
+
+ return mono_exception_from_name_two_strings (
+ mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname);
+}
+
+/**
+ * mono_get_exception_type_initialization:
+ * @type_name: the name of the type that failed to initialize.
+ * @inner: the inner exception.
+ *
+ * Returns: a new instance of the System.TypeInitializationException
+ */
+MonoException *
+mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner)
+{
+ MonoClass *klass;
+ gpointer args [2];
+ MonoObject *exc;
+ MonoMethod *method;
+ gpointer iter;
+
+ klass = mono_class_from_name (mono_get_corlib (), "System", "TypeInitializationException");
+ g_assert (klass);
+
+ mono_class_init (klass);
+
+ /* 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_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;
+}