Exemple #1
0
void
mono_error_set_pending_exception (MonoError *error)
{
	MonoException *ex = mono_error_convert_to_exception (error);
	if (ex)
		mono_set_pending_exception (ex);
}
Exemple #2
0
/**
 * mono_error_set_pending_exception:
 * @error: The error
 *
 *
 * If @error is set, convert it to an exception and set the pending exception for the current icall.
 * Returns TRUE if @error was set, or FALSE otherwise, so that you can write:
 *    if (mono_error_set_pending_exception (error)) {
 *      { ... cleanup code ... }
 *      return;
 *    }
 */
gboolean
mono_error_set_pending_exception (MonoError *error)
{
	MonoException *ex = mono_error_convert_to_exception (error);
	if (ex) {
		mono_set_pending_exception (ex);
		return TRUE;
	} else {
		return FALSE;
	}
}
Exemple #3
0
MonoString  *
ves_icall_System_String_InternalIntern (MonoString *str)
{
	MonoString *res;

	res = mono_string_intern(str);
	if (!res) {
		mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
		return NULL;
	}
	return res;
}
Exemple #4
0
MonoString *
ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc)
{
	char *trace;
	MonoString *res;
	if (!exc) {
		mono_set_pending_exception (mono_get_exception_argument_null ("exception"));
		return NULL;
	}

	trace = mono_exception_get_native_backtrace (exc);
	res = mono_string_new (mono_domain_get (), trace);
	g_free (trace);
	return res;
}
Exemple #5
0
void ves_icall_System_Text_Normalization_load_normalization_resource (guint8 **argProps,
																	  guint8 **argMappedChars,
																	  guint8 **argCharMapIndex,
																	  guint8 **argHelperIndex,
																	  guint8 **argMapIdxToComposite,
																	  guint8 **argCombiningClass)
{
#ifdef DISABLE_NORMALIZATION
	mono_set_pending_exception (mono_get_exception_not_supported ("This runtime has been compiled without string normalization support."));
	return;
#else
	*argProps = (guint8*)props;
	*argMappedChars = (guint8*) mappedChars;
	*argCharMapIndex = (guint8*) charMapIndex;
	*argHelperIndex = (guint8*) helperIndex;
	*argMapIdxToComposite = (guint8*) mapIdxToComposite;
	*argCombiningClass = (guint8*)combiningClass;
#endif
}
Exemple #6
0
MonoArray *
ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
{
	MonoError error;
	MonoArray *procs;
	gboolean ret;
	DWORD needed;
	int count;
	DWORD *pids;

	count = 512;
	do {
		pids = g_new0 (DWORD, count);
		ret = mono_process_win_enum_processes (pids, count * sizeof (guint32), &needed);
		if (ret == FALSE) {
			MonoException *exc;

			g_free (pids);
			pids = NULL;
			exc = mono_get_exception_not_supported ("This system does not support EnumProcesses");
			mono_set_pending_exception (exc);
			return NULL;
		}
		if (needed < (count * sizeof (guint32)))
			break;
		g_free (pids);
		pids = NULL;
		count = (count * 3) / 2;
	} while (TRUE);

	count = needed / sizeof (guint32);
	procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error);
	if (mono_error_set_pending_exception (&error)) {
		g_free (pids);
		return NULL;
	}

	memcpy (mono_array_addr (procs, guint32, 0), pids, needed);
	g_free (pids);
	pids = NULL;

	return procs;
}
Exemple #7
0
static
void continuations_not_supported (void)
{
	mono_set_pending_exception (mono_get_exception_not_implemented ("Tasklets are not implemented on this platform."));
}