/** * mono_exception_from_token_two_strings: * * Same as mono_exception_from_name_two_strings, but lookup the exception class using * IMAGE and TOKEN. */ MonoException * mono_exception_from_token_two_strings (MonoImage *image, guint32 token, MonoString *arg1_raw, MonoString *arg2_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoString, arg1); MONO_HANDLE_DCL (MonoString, arg2); MonoExceptionHandle ret = mono_exception_from_token_two_strings_checked (image, token, arg1, arg2, error); mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_exception_from_name_two_strings: * \param image the Mono image where to look for the class * \param name_space the namespace for the class * \param name class name * \param a1 first string argument to pass * \param a2 second string argument to pass * * Creates an exception from a constructor that takes two string * arguments. * * \returns the initialized exception instance. */ MonoException * mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, const char *name, MonoString *a1_raw, MonoString *a2_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoString, a1); MONO_HANDLE_DCL (MonoString, a2); MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, error); mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_get_exception_reflection_type_load: * \param types an array of types that were defined in the moduled loaded. * \param exceptions an array of exceptions that were thrown during the type loading. * \returns a new instance of the \c System.Reflection.ReflectionTypeLoadException */ MonoException * mono_get_exception_reflection_type_load (MonoArray *types_raw, MonoArray *exceptions_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoArray, types); MONO_HANDLE_DCL (MonoArray, exceptions); MonoExceptionHandle ret = mono_get_exception_reflection_type_load_checked (types, exceptions, error); if (!is_ok (error)) ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }
void mono_w32mutex_abandon (MonoInternalThread *internal_raw) { HANDLE_FUNCTION_ENTER () MONO_HANDLE_DCL (MonoInternalThread, internal); g_assert (mono_thread_internal_is_current_handle (internal)); if (!MONO_HANDLE_GETVAL (internal, owned_mutexes)) goto exit; while (MONO_HANDLE_GETVAL (internal, owned_mutexes)->len) { MonoW32Handle *handle_data; MonoW32HandleMutex *mutex_handle; MonoNativeThreadId tid; gpointer handle; handle = g_ptr_array_index (MONO_HANDLE_GETVAL (internal, owned_mutexes), 0); if (!mono_w32handle_lookup_and_ref (handle, &handle_data)) g_error ("%s: unkown handle %p", __func__, handle); if (handle_data->type != MONO_W32TYPE_MUTEX && handle_data->type != MONO_W32TYPE_NAMEDMUTEX) g_error ("%s: unkown mutex handle %p", __func__, handle); mutex_handle = (MonoW32HandleMutex*) handle_data->specific; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_MUTEX, "%s: abandoning %s handle %p", __func__, mono_w32handle_get_typename (handle_data->type), handle); tid = MONO_UINT_TO_NATIVE_THREAD_ID (MONO_HANDLE_GETVAL (internal, tid)); if (!pthread_equal (mutex_handle->tid, tid)) g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p", __func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid); mono_w32handle_lock (handle_data); mutex_handle->recursion = 0; mutex_handle->tid = 0; mutex_handle->abandoned = TRUE; mono_w32handle_set_signal_state (handle_data, TRUE, FALSE); thread_disown_mutex (internal, handle); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_MUTEX, "%s: abandoned %s handle %p", __func__, mono_w32handle_get_typename (handle_data->type), handle); mono_w32handle_unlock (handle_data); mono_w32handle_unref (handle_data); } g_ptr_array_free (MONO_HANDLE_GETVAL (internal, owned_mutexes), TRUE); MONO_HANDLE_SETVAL(internal, owned_mutexes, GPtrArray*, NULL); exit: HANDLE_FUNCTION_RETURN (); }
/** * mono_get_exception_file_not_found: * \param fname the name of the file not found. * \returns a new instance of the \c System.IO.FileNotFoundException */ MonoException * mono_get_exception_file_not_found (MonoString *fname_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoString, fname); MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, error); mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_get_exception_type_initialization: * \param type_name the name of the type that failed to initialize. * \param inner the inner exception. * \returns a new instance of the \c System.TypeInitializationException */ MonoException * mono_get_exception_type_initialization (const gchar *type_name, MonoException* inner_raw) { HANDLE_FUNCTION_ENTER (); MONO_HANDLE_DCL (MonoException, inner); ERROR_DECL (error); MonoExceptionHandle ret = mono_get_exception_type_initialization_handle (type_name, inner, error); if (!is_ok (error)) { ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); mono_error_cleanup (error); } HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_get_exception_runtime_wrapped: */ MonoException * mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoObject, wrapped_exception); MonoExceptionHandle ret = mono_get_exception_runtime_wrapped_handle (wrapped_exception, error); if (!is_ok (error)) { mono_error_cleanup (error); ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); } HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_get_exception_file_not_found2: * \param msg an informative message for the user. * \param fname the name of the file not found. * \returns a new instance of the \c System.IO.FileNotFoundException */ MonoException * mono_get_exception_file_not_found2 (const char *msg, MonoString *fname_raw) { HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MONO_HANDLE_DCL (MonoString, fname); MonoStringHandle s = NULL_HANDLE_STRING; if (msg) { s = mono_string_new_handle (mono_domain_get (), msg, error); mono_error_assert_ok (error); } MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname, error); mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }
/** * mono_get_exception_type_load: * \param class_name the name of the class that could not be loaded * \param assembly_name the assembly where the class was looked up. * \returns a new instance of the \c System.TypeLoadException */ MonoException * mono_get_exception_type_load (MonoString *class_name_raw, char *assembly_name) { ERROR_DECL (error); HANDLE_FUNCTION_ENTER (); MONO_HANDLE_DCL (MonoString, class_name); MonoStringHandle s = NULL_HANDLE_STRING; MonoDomain * const domain = mono_domain_get (); if (assembly_name) { s = mono_string_new_handle (domain, assembly_name, error); mono_error_assert_ok (error); } else s = mono_string_empty_handle (domain); MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", class_name, s, error); mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_OBJ (ret); }