<?xml version="1.0" encoding="us-ascii"?><span> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>mono-api-exc.html</title> <style type="text/css"> h3 { font-size: 18px; padding-bottom: 4pt; border-bottom: 2px solid #dddddd; } .api { border: 1px solid; padding: 10pt; margin: 10pt; } .api-entry { border-bottom: none; font-size: 18px; } .prototype { border: 1px solid; background-color: #f2f2f2; padding: 5pt; margin-top: 5pt; margin-bottom: 5pt; } .header { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } .code { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } </style> </head> <body> <h2>Exception Handling</h2> <div class="header"> void <a href="#api:mono_raise_exception">mono_raise_exception</a> (MonoException *ex) ; void <a href="#api:mono_unhandled_exception">mono_unhandled_exception</a> (MonoObject *exc); void <a href="#api:mono_print_unhandled_exception">mono_print_unhandled_exception</a> (MonoObject *exc); MonoException* <a href="#api:mono_exception_from_name_domain">mono_exception_from_name_domain</a> (MonoDomain *domain, MonoImage *image, ; MonoException* <a href="#api:mono_exception_from_name">mono_exception_from_name</a> (MonoImage *image, const char *name_space; MonoException* <a href="#api:mono_exception_from_name_msg">mono_exception_from_name_msg</a> (MonoImage *image, const char *name_space; MonoException* <a href="#api:mono_exception_from_name_two_strings">mono_exception_from_name_two_strings</a> (MonoImage *image, const char *name_space; MonoException* <a href="#api:mono_get_exception_appdomain_unloaded">mono_get_exception_appdomain_unloaded</a> (void); MonoException* <a href="#api:mono_get_exception_argument">mono_get_exception_argument</a> (const char *arg, const char *msg); MonoException* <a href="#api:mono_get_exception_argument_null">mono_get_exception_argument_null</a> (const char *arg); MonoException* <a href="#api:mono_get_exception_argument_out_of_range">mono_get_exception_argument_out_of_range</a> (const char *arg); MonoException* <a href="#api:mono_get_exception_arithmetic">mono_get_exception_arithmetic</a> (); MonoException* <a href="#api:mono_get_exception_array_type_mismatch">mono_get_exception_array_type_mismatch</a> (); MonoException* <a href="#api:mono_get_exception_bad_image_format">mono_get_exception_bad_image_format</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_cannot_unload_appdomain">mono_get_exception_cannot_unload_appdomain</a> (const char *msg); <a href="#api:mono_get_exception_class"></a> MonoException* <a href="#api:mono_get_exception_divide_by_zero">mono_get_exception_divide_by_zero</a> (); MonoException* <a href="#api:mono_get_exception_execution_engine">mono_get_exception_execution_engine</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_file_not_found2">mono_get_exception_file_not_found2</a> (const char *msg, MonoString *fname); MonoException* <a href="#api:mono_get_exception_file_not_found">mono_get_exception_file_not_found</a> (MonoString *fname); MonoException* <a href="#api:mono_get_exception_index_out_of_range">mono_get_exception_index_out_of_range</a> (); MonoException* <a href="#api:mono_get_exception_invalid_cast">mono_get_exception_invalid_cast</a> (); MonoException* <a href="#api:mono_get_exception_io">mono_get_exception_io</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_missing_method">mono_get_exception_missing_method</a> (const char *class_name, const char *member_name); MonoException* <a href="#api:mono_get_exception_not_implemented">mono_get_exception_not_implemented</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_null_reference">mono_get_exception_null_reference</a> (); MonoException* <a href="#api:mono_get_exception_overflow">mono_get_exception_overflow</a> (); MonoException* <a href="#api:mono_get_exception_security">mono_get_exception_security</a> (); MonoException* <a href="#api:mono_get_exception_serialization">mono_get_exception_serialization</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_stack_overflow">mono_get_exception_stack_overflow</a> (void); MonoException* <a href="#api:mono_get_exception_synchronization_lock">mono_get_exception_synchronization_lock</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_thread_abort">mono_get_exception_thread_abort</a> (); MonoException* <a href="#api:mono_get_exception_thread_state">mono_get_exception_thread_state</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_type_initialization">mono_get_exception_type_initialization</a> (const gchar *type_name, MonoException *inner); MonoException* <a href="#api:mono_get_exception_type_load">mono_get_exception_type_load</a> (MonoString *class_name, char *assembly_name); MonoException* <a href="#api:mono_get_exception_invalid_operation">mono_get_exception_invalid_operation</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_missing_field">mono_get_exception_missing_field</a> (const char *class_name, const char *member_name); MonoException* <a href="#api:mono_get_exception_not_supported">mono_get_exception_not_supported</a> (const char *msg); MonoException* <a href="#api:mono_get_exception_reflection_type_load">mono_get_exception_reflection_type_load</a> (MonoArray *types, MonoArray *exceptions); </div> <h3>Raising and Catching exceptions</h3> <a name="api:mono_raise_exception"></a> <div class="api"> <div class="api-entry">mono_raise_exception</div> <div class="prototype">void mono_raise_exception (MonoException *ex) </div> <p /> <b>Parameters</b> <blockquote><dt><i>ex:</i></dt><dd> exception object</dd></blockquote> <b>Remarks</b> <p /> Signal the runtime that the exception <i>ex</i> has been raised in unmanaged code. </div> <a name="api:mono_unhandled_exception"></a> <div class="api"> <div class="api-entry">mono_unhandled_exception</div> <div class="prototype">void mono_unhandled_exception (MonoObject *exc) </div> <p /> <b>Parameters</b> <blockquote><dt><i>exc:</i></dt><dd> exception thrown</dd></blockquote> <b>Remarks</b> <p /> This is a VM internal routine. 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 </div> <a name="api:mono_print_unhandled_exception"></a> <div class="api"> <div class="api-entry">mono_print_unhandled_exception</div> <div class="prototype">void mono_print_unhandled_exception (MonoObject *exc) </div> <p /> <b>Parameters</b> <blockquote><dt><i>exc:</i></dt><dd> The exception</dd></blockquote> <b>Remarks</b> <p /> Prints the unhandled exception. </div><h3>Exception Types: General API</h3> <a name="api:mono_exception_from_name_domain"></a> <div class="api"> <div class="api-entry">mono_exception_from_name_domain</div> <div class="prototype">MonoException* mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name) </div> <p /> <b>Parameters</b> <blockquote><dt><i>domain:</i></dt><dd> Domain where the return object will be created.</dd><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd></blockquote> <b>Returns</b> <blockquote> the initialized exception instance. </blockquote> <b>Remarks</b> <p /> Creates an exception object of the given namespace/name class on the given domain. </div> <a name="api:mono_exception_from_name"></a> <div class="api"> <div class="api-entry">mono_exception_from_name</div> <div class="prototype">MonoException* mono_exception_from_name (MonoImage *image, const char *name_space, const char *name) </div> <p /> <b>Parameters</b> <blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd></blockquote> <b>Returns</b> <blockquote> the initialized exception instance. </blockquote> <b>Remarks</b> <p /> Creates an exception of the given namespace/name class in the current domain. </div> <a name="api:mono_exception_from_name_msg"></a> <div class="api"> <div class="api-entry">mono_exception_from_name_msg</div> <div class="prototype">MonoException* mono_exception_from_name_msg (MonoImage *image, const char *name_space, const char *name, const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd><dt><i>msg:</i></dt><dd> the message to embed inside the exception</dd></blockquote> <b>Returns</b> <blockquote> the initialized exception instance. </blockquote> <b>Remarks</b> <p /> Creates an exception and initializes its message field. </div> <a name="api:mono_exception_from_name_two_strings"></a> <div class="api"> <div class="api-entry">mono_exception_from_name_two_strings</div> <div class="prototype">MonoException* mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, const char *name, MonoString *a1, MonoString *a2) </div> <p /> <b>Parameters</b> <blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd><dt><i>a1:</i></dt><dd> first string argument to pass</dd><dt><i>a2:</i></dt><dd> second string argument to pass</dd></blockquote> <b>Returns</b> <blockquote> the initialized exception instance. </blockquote> <b>Remarks</b> <p /> Creates an exception from a constructor that takes two string arguments. </div><h3>Obtaining Common Exceptions</h3> <p />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. <a name="api:mono_get_exception_appdomain_unloaded"></a> <div class="api"> <div class="api-entry">mono_get_exception_appdomain_unloaded</div> <div class="prototype">MonoException* mono_get_exception_appdomain_unloaded (void) </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.AppDomainUnloadedException </blockquote> </div> <a name="api:mono_get_exception_argument"></a> <div class="api"> <div class="api-entry">mono_get_exception_argument</div> <div class="prototype">MonoException* mono_get_exception_argument (const char *arg, const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>arg:</i></dt><dd> the name of the invalid argument.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.ArgumentException </blockquote> </div> <a name="api:mono_get_exception_argument_null"></a> <div class="api"> <div class="api-entry">mono_get_exception_argument_null</div> <div class="prototype">MonoException* mono_get_exception_argument_null (const char *arg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>arg:</i></dt><dd> the name of the argument that is null</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.ArgumentNullException </blockquote> </div> <a name="api:mono_get_exception_argument_out_of_range"></a> <div class="api"> <div class="api-entry">mono_get_exception_argument_out_of_range</div> <div class="prototype">MonoException* mono_get_exception_argument_out_of_range (const char *arg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>arg:</i></dt><dd> the name of the out of range argument.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.ArgumentOutOfRangeException </blockquote> </div> <a name="api:mono_get_exception_arithmetic"></a> <div class="api"> <div class="api-entry">mono_get_exception_arithmetic</div> <div class="prototype">MonoException* mono_get_exception_arithmetic () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.ArithmeticException. </blockquote> </div> <a name="api:mono_get_exception_array_type_mismatch"></a> <div class="api"> <div class="api-entry">mono_get_exception_array_type_mismatch</div> <div class="prototype">MonoException* mono_get_exception_array_type_mismatch () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.ArrayTypeMismatchException </blockquote> </div> <a name="api:mono_get_exception_bad_image_format"></a> <div class="api"> <div class="api-entry">mono_get_exception_bad_image_format</div> <div class="prototype">MonoException* mono_get_exception_bad_image_format (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> an informative message for the user.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.BadImageFormatException </blockquote> </div> <a name="api:mono_get_exception_cannot_unload_appdomain"></a> <div class="api"> <div class="api-entry">mono_get_exception_cannot_unload_appdomain</div> <div class="prototype">MonoException* mono_get_exception_cannot_unload_appdomain (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.CannotUnloadAppDomainException </blockquote> </div> <a name="api:mono_get_exception_class"></a> <div class="api"> <div class="api-entry">mono_get_exception_class</div> <div class="prototype">Prototype: mono_get_exception_class</div> <p /> </div> <a name="api:mono_get_exception_divide_by_zero"></a> <div class="api"> <div class="api-entry">mono_get_exception_divide_by_zero</div> <div class="prototype">MonoException* mono_get_exception_divide_by_zero () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.DivideByZeroException </blockquote> </div> <a name="api:mono_get_exception_execution_engine"></a> <div class="api"> <div class="api-entry">mono_get_exception_execution_engine</div> <div class="prototype">MonoException* mono_get_exception_execution_engine (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.ExecutionEngineException </blockquote> </div> <a name="api:mono_get_exception_file_not_found2"></a> <div class="api"> <div class="api-entry">mono_get_exception_file_not_found2</div> <div class="prototype">MonoException* mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> an informative message for the user.</dd><dt><i>fname:</i></dt><dd> the name of the file not found.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.IO.FileNotFoundException </blockquote> </div> <a name="api:mono_get_exception_file_not_found"></a> <div class="api"> <div class="api-entry">mono_get_exception_file_not_found</div> <div class="prototype">MonoException* mono_get_exception_file_not_found (MonoString *fname) </div> <p /> <b>Parameters</b> <blockquote><dt><i>fname:</i></dt><dd> the name of the file not found.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.IO.FileNotFoundException </blockquote> </div> <a name="api:mono_get_exception_index_out_of_range"></a> <div class="api"> <div class="api-entry">mono_get_exception_index_out_of_range</div> <div class="prototype">MonoException* mono_get_exception_index_out_of_range () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.IndexOutOfRangeException </blockquote> </div> <a name="api:mono_get_exception_invalid_cast"></a> <div class="api"> <div class="api-entry">mono_get_exception_invalid_cast</div> <div class="prototype">MonoException* mono_get_exception_invalid_cast () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.InvalidCastException </blockquote> </div> <a name="api:mono_get_exception_io"></a> <div class="api"> <div class="api-entry">mono_get_exception_io</div> <div class="prototype">MonoException* mono_get_exception_io (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to present to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.IO.IOException </blockquote> </div> <a name="api:mono_get_exception_missing_method"></a> <div class="api"> <div class="api-entry">mono_get_exception_missing_method</div> <div class="prototype">MonoException* mono_get_exception_missing_method (const char *class_name, const char *member_name) </div> <p /> <b>Parameters</b> <blockquote><dt><i>class_name:</i></dt><dd> the class where the lookup was performed.</dd><dt><i>member_name:</i></dt><dd> the name of the missing method.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.MissingMethodException </blockquote> </div> <a name="api:mono_get_exception_not_implemented"></a> <div class="api"> <div class="api-entry">mono_get_exception_not_implemented</div> <div class="prototype">MonoException* mono_get_exception_not_implemented (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.NotImplementedException </blockquote> </div> <a name="api:mono_get_exception_null_reference"></a> <div class="api"> <div class="api-entry">mono_get_exception_null_reference</div> <div class="prototype">MonoException* mono_get_exception_null_reference () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.NullReferenceException </blockquote> </div> <a name="api:mono_get_exception_overflow"></a> <div class="api"> <div class="api-entry">mono_get_exception_overflow</div> <div class="prototype">MonoException* mono_get_exception_overflow () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.OverflowException </blockquote> </div> <a name="api:mono_get_exception_security"></a> <div class="api"> <div class="api-entry">mono_get_exception_security</div> <div class="prototype">MonoException* mono_get_exception_security () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.Security.SecurityException </blockquote> </div> <a name="api:mono_get_exception_serialization"></a> <div class="api"> <div class="api-entry">mono_get_exception_serialization</div> <div class="prototype">MonoException* mono_get_exception_serialization (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.Runtime.Serialization.SerializationException </blockquote> </div> <a name="api:mono_get_exception_stack_overflow"></a> <div class="api"> <div class="api-entry">mono_get_exception_stack_overflow</div> <div class="prototype">MonoException* mono_get_exception_stack_overflow (void) </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.StackOverflowException </blockquote> </div> <a name="api:mono_get_exception_synchronization_lock"></a> <div class="api"> <div class="api-entry">mono_get_exception_synchronization_lock</div> <div class="prototype">MonoException* mono_get_exception_synchronization_lock (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.SynchronizationLockException </blockquote> </div> <a name="api:mono_get_exception_thread_abort"></a> <div class="api"> <div class="api-entry">mono_get_exception_thread_abort</div> <div class="prototype">MonoException* mono_get_exception_thread_abort () </div> <p /> <b>Returns</b> <blockquote> a new instance of the System.Threading.ThreadAbortException. </blockquote> </div> <a name="api:mono_get_exception_thread_state"></a> <div class="api"> <div class="api-entry">mono_get_exception_thread_state</div> <div class="prototype">MonoException* mono_get_exception_thread_state (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to present to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.Threading.ThreadStateException </blockquote> </div> <a name="api:mono_get_exception_type_initialization"></a> <div class="api"> <div class="api-entry">mono_get_exception_type_initialization</div> <div class="prototype">MonoException* mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner) </div> <p /> <b>Parameters</b> <blockquote><dt><i>type_name:</i></dt><dd> the name of the type that failed to initialize.</dd><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.TypeInitializationException </blockquote> </div> <a name="api:mono_get_exception_type_load"></a> <div class="api"> <div class="api-entry">mono_get_exception_type_load</div> <div class="prototype">MonoException* mono_get_exception_type_load (MonoString *class_name, char *assembly_name) </div> <p /> <b>Parameters</b> <blockquote><dt><i>class_name:</i></dt><dd> the name of the class that could not be loaded</dd><dt><i>assembly_name:</i></dt><dd> the assembly where the class was looked up.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.TypeLoadException. </blockquote> </div> <a name="api:mono_get_exception_invalid_operation"></a> <div class="api"> <div class="api-entry">mono_get_exception_invalid_operation</div> <div class="prototype">MonoException* mono_get_exception_invalid_operation (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.InvalidOperationException </blockquote> </div> <a name="api:mono_get_exception_missing_field"></a> <div class="api"> <div class="api-entry">mono_get_exception_missing_field</div> <div class="prototype">MonoException* mono_get_exception_missing_field (const char *class_name, const char *member_name) </div> <p /> <b>Parameters</b> <blockquote><dt><i>class_name:</i></dt><dd> the class where the lookup was performed</dd><dt><i>member_name:</i></dt><dd> the name of the missing method.</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.MissingFieldException </blockquote> </div> <a name="api:mono_get_exception_not_supported"></a> <div class="api"> <div class="api-entry">mono_get_exception_not_supported</div> <div class="prototype">MonoException* mono_get_exception_not_supported (const char *msg) </div> <p /> <b>Parameters</b> <blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote> <b>Returns</b> <blockquote> a new instance of the System.NotSupportedException </blockquote> </div></body> </html> </span>