Mono's exception handling contains methods to create `MonoException*` objects that can be raised.
Alternatively, you can obtain an exception that you can raise from some of the most common exceptions in the .NET Runtime.
If you plan on running your code in Mono's Cooperative mode for the Garbage Collector (for example, if you are using pure Bitcode code generation), it you should avoid raising an exception from any method that is not the entry point to the internal call.
It is recommended that if you need to raise an error condition from nested parts of your code, surface this error to the topmost method that is surfaced as an internal call and raise the exception there.
mono_raise_exception
ex | exception object |
mono_unhandled_exception
exc | exception thrown |
We call this function when we detect an unhandled exception in the default domain.
It invokes the UnhandledException
event in AppDomain
or prints
a warning to the console
mono_print_unhandled_exception
exc | The exception |
mono_exception_from_name_domain
domain | Domain where the return object will be created. |
image | the Mono image where to look for the class |
name_space | the namespace for the class |
name | class name |
Creates an exception object of the given namespace/name class on the given domain.
mono_exception_from_name
image | the Mono image where to look for the class |
name_space | the namespace for the class |
name | class name |
Creates an exception of the given namespace/name class in the current domain.
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.
mono_exception_from_name_two_strings
image | the Mono image where to look for the class |
name_space | the namespace for the class |
name | class name |
a1 | first string argument to pass |
a2 | second string argument to pass |
Creates an exception from a constructor that takes two string arguments.
There are a number of common exceptions that are used by the runtime, use the routines in this section to get a copy of those exceptions.
mono_get_exception_appdomain_unloaded
System.AppDomainUnloadedException
mono_get_exception_argument
arg | the name of the invalid argument. |
System.ArgumentException
mono_get_exception_argument_null
arg | the name of the argument that is null |
System.ArgumentNullException
mono_get_exception_argument_out_of_range
arg | the name of the out of range argument. |
System.ArgumentOutOfRangeException
mono_get_exception_arithmetic
System.ArithmeticException
mono_get_exception_array_type_mismatch
System.ArrayTypeMismatchException
mono_get_exception_bad_image_format
msg | an informative message for the user. |
System.BadImageFormatException
mono_get_exception_cannot_unload_appdomain
inner | the inner exception. |
System.CannotUnloadAppDomainException
mono_get_exception_class
MonoClass*
for the type
.
MonoClass*
that the runtime is using for System.Exception
.mono_get_exception_divide_by_zero
System.DivideByZeroException
mono_get_exception_execution_engine
msg | the message to pass to the user |
System.ExecutionEngineException
mono_get_exception_file_not_found2
msg | an informative message for the user. |
fname | the name of the file not found. |
System.IO.FileNotFoundException
mono_get_exception_file_not_found
fname | the name of the file not found. |
System.IO.FileNotFoundException
mono_get_exception_index_out_of_range
System.IndexOutOfRangeException
mono_get_exception_invalid_cast
System.InvalidCastException
mono_get_exception_io
msg | the message to present to the user |
System.IO.IOException
mono_get_exception_missing_method
class_name | the class where the lookup was performed. |
member_name | the name of the missing method. |
System.MissingMethodException
mono_get_exception_not_implemented
msg | the message to pass to the user |
System.NotImplementedException
mono_get_exception_null_reference
System.NullReferenceException
mono_get_exception_overflow
System.OverflowException
mono_get_exception_security
System.Security.SecurityException
mono_get_exception_serialization
msg | the message to pass to the user |
System.Runtime.Serialization.SerializationException
mono_get_exception_stack_overflow
System.StackOverflowException
mono_get_exception_synchronization_lock
inner | the inner exception. |
System.SynchronizationLockException
mono_get_exception_thread_abort
System.Threading.ThreadAbortException
mono_get_exception_thread_state
msg | the message to present to the user |
System.Threading.ThreadStateException
mono_get_exception_type_initialization
type_name | the name of the type that failed to initialize. |
inner | the inner exception. |
System.TypeInitializationException
mono_get_exception_type_load
class_name | the name of the class that could not be loaded |
assembly_name | the assembly where the class was looked up. |
System.TypeLoadException
mono_get_exception_invalid_operation
msg | the message to pass to the user |
System.InvalidOperationException
mono_get_exception_missing_field
class_name | the class where the lookup was performed |
member_name | the name of the missing field. |
System.MissingFieldException
mono_get_exception_not_supported
msg | the message to pass to the user |
System.NotSupportedException
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. |
System.Reflection.ReflectionTypeLoadException
mono_exception_from_token_two_strings
Same as mono_exception_from_name_two_strings, but lookup the exception class using IMAGE and TOKEN.
mono_get_exception_bad_image_format2
msg | an informative message for the user. |
fname | The full name of the file with the invalid image. |
System.BadImageFormatException
mono_get_exception_field_access
System.FieldAccessException
mono_get_exception_method_access
System.MethodAccessException
mono_get_exception_out_of_memory
System.OutOfMemoryException
mono_get_exception_runtime_wrapped