Example #1
0
MonoException *
mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception)
{
	MonoRuntimeWrappedException *ex = (MonoRuntimeWrappedException*)
		mono_exception_from_name (mono_get_corlib (), "System.Runtime.CompilerServices",
								  "RuntimeWrappedException");

   MONO_OBJECT_SETREF (ex, wrapped_exception, wrapped_exception);
   return (MonoException*)ex;
}	
Example #2
0
/**
 * mono_exception_from_name_msg:
 * @image: the Mono image where to look for the class
 * @name_space: the namespace for the class
 * @name: class name
 * @msg: the message to embed inside the exception
 *
 * Creates an exception and initializes its message field.
 *
 * Returns: the initialized exception instance.
 */
MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
			      const char *name, const char *msg)
{
	MonoException *ex;

	ex = mono_exception_from_name (image, name_space, name);

	if (msg)
		MONO_OBJECT_SETREF (ex, message, mono_string_new (mono_object_get_domain ((MonoObject*)ex), msg));

	return ex;
}
Example #3
0
/**
 * mono_get_exception_argument_out_of_range:
 * @arg: the name of the out of range argument.
 *
 * Returns: a new instance of the `System.ArgumentOutOfRangeException`
 */
MonoException *
mono_get_exception_argument_out_of_range (const char *arg)
{
	MonoException *ex;

	ex = mono_exception_from_name (
		mono_get_corlib (), "System", "ArgumentOutOfRangeException");

	if (arg) {
		MonoArgumentException *argex = (MonoArgumentException *)ex;
		MONO_OBJECT_SETREF (argex, param_name, mono_string_new (mono_object_get_domain ((MonoObject*)ex), arg));
	}
	
	return ex;
}
Example #4
0
/**
 * 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");	
}
Example #5
0
/**
 * 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");
}
Example #6
0
/**
 * mono_get_exception_array_type_mismatch:
 *
 * Returns: a new instance of the `System.ArrayTypeMismatchException`
 */
MonoException *
mono_get_exception_array_type_mismatch ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "ArrayTypeMismatchException");
}
Example #7
0
/**
 * mono_get_exception_index_out_of_range:
 *
 * Returns: a new instance of the `System.IndexOutOfRangeException`
 */
MonoException *
mono_get_exception_index_out_of_range ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "IndexOutOfRangeException");
}
Example #8
0
/**
 * mono_get_exception_invalid_cast:
 *
 * Returns: a new instance of the `System.InvalidCastException`
 */
MonoException *
mono_get_exception_invalid_cast ()
{
	return mono_exception_from_name (mono_get_corlib (), "System", "InvalidCastException");
}
Example #9
0
/**
 * mono_get_exception_overflow:
 *
 * Returns: a new instance of the `System.OverflowException`
 */
MonoException *
mono_get_exception_overflow ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "OverflowException");
}
Example #10
0
/**
 * mono_get_exception_arithmetic:
 *
 * Returns: a new instance of the `System.ArithmeticException`
 */
MonoException *
mono_get_exception_arithmetic ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "ArithmeticException");
}
Example #11
0
/**
 * mono_get_exception_thread_interrupted:
 *
 * Returns: a new instance of the `System.Threading.ThreadInterruptedException`
 */
MonoException *
mono_get_exception_thread_interrupted ()
{
	return mono_exception_from_name (mono_get_corlib (), "System.Threading",
					 "ThreadInterruptedException");
}
Example #12
0
/**
 * mono_get_exception_thread_abort:
 *
 * Returns: a new instance of the `System.Threading.ThreadAbortException`
 */
MonoException *
mono_get_exception_thread_abort ()
{
	return mono_exception_from_name (mono_get_corlib (), "System.Threading",
					 "ThreadAbortException");
}
Example #13
0
/**
 * mono_get_exception_security:
 *
 * Returns: a new instance of the `System.Security.SecurityException`
 */
MonoException *
mono_get_exception_security ()
{
	return mono_exception_from_name (mono_get_corlib (), "System.Security",
					 "SecurityException");
}
Example #14
0
/**
 * mono_get_exception_divide_by_zero:
 *
 * Returns: a new instance of the `System.DivideByZeroException`
 */
MonoException *
mono_get_exception_divide_by_zero ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "DivideByZeroException");
}
Example #15
0
/**
 * mono_get_exception_out_of_memory:
 *
 * Returns: a new instance of the `System.OutOfMemoryException`
 */
MonoException *
mono_get_exception_out_of_memory (void)
{
	return mono_exception_from_name (mono_get_corlib (), "System", "OutOfMemoryException");
}
Example #16
0
/**
 * mono_get_exception_null_reference:
 *
 * Returns: a new instance of the `System.NullReferenceException`
 */
MonoException *
mono_get_exception_null_reference ()
{
	return mono_exception_from_name (mono_get_corlib (), "System",
					 "NullReferenceException");
}
Example #17
0
/**
 * mono_get_exception_method_access:
 *
 * Returns: a new instance of the `System.MethodAccessException`
 */
MonoException *
mono_get_exception_method_access (void)
{
	return mono_exception_from_name (mono_get_corlib (), "System", "MethodAccessException");
}
Example #18
0
MonoExceptionHandle
mono_get_exception_out_of_memory_handle (void)
{
	return MONO_HANDLE_NEW (MonoException, mono_exception_from_name (mono_get_corlib (), "System", "OutOfMemoryException"));
}