add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *hash);
static MonoAppDomain *
-mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetup *setup);
+mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetup *setup, MonoError *error);
static char *
get_shadow_assembly_location_base (MonoDomain *domain, MonoError *error);
mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
MonoThreadAttachCB attach_cb)
{
+ MonoError error;
MonoAppDomainSetup *setup;
MonoAppDomain *ad;
MonoClass *klass;
mono_thread_init (start_cb, attach_cb);
klass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
- setup = (MonoAppDomainSetup *) mono_object_new_pinned (domain, klass);
+ setup = (MonoAppDomainSetup *) mono_object_new_pinned (domain, klass, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
klass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
- ad = (MonoAppDomain *) mono_object_new_pinned (domain, klass);
+ ad = (MonoAppDomain *) mono_object_new_pinned (domain, klass, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
ad->data = domain;
domain->domain = ad;
domain->setup = setup;
/* mscorlib is loaded before we install the load hook */
mono_domain_fire_assembly_load (mono_defaults.corlib->assembly, NULL);
-
+
return;
}
void
mono_context_init (MonoDomain *domain)
{
+ MonoError error;
MonoClass *klass;
MonoAppContext *context;
klass = mono_class_from_name (mono_defaults.corlib, "System.Runtime.Remoting.Contexts", "Context");
- context = (MonoAppContext *) mono_object_new_pinned (domain, klass);
+ context = (MonoAppContext *) mono_object_new_pinned (domain, klass, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
context->domain_id = domain->domain_id;
context->context_id = 0;
ves_icall_System_Runtime_Remoting_Contexts_Context_RegisterContext (context);
MonoDomain *
mono_domain_create_appdomain (char *friendly_name, char *configuration_file)
{
+ MonoError error;
MonoAppDomain *ad;
MonoAppDomainSetup *setup;
MonoClass *klass;
setup = (MonoAppDomainSetup *) mono_object_new (mono_domain_get (), klass);
setup->configuration_file = configuration_file != NULL ? mono_string_new (mono_domain_get (), configuration_file) : NULL;
- ad = mono_domain_create_appdomain_internal (friendly_name, setup);
+ ad = mono_domain_create_appdomain_internal (friendly_name, setup, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
return mono_domain_from_appdomain (ad);
}
}
static MonoAppDomain *
-mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetup *setup)
+mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetup *setup, MonoError *error)
{
- MonoError error;
MonoClass *adclass;
MonoAppDomain *ad;
MonoDomain *data;
char *shadow_location;
-
+
adclass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
/* FIXME: pin all those objects */
#ifndef DISABLE_SHADOW_COPY
/*FIXME, guard this for when the debugger is not running */
- shadow_location = get_shadow_assembly_location_base (data, &error);
- if (!mono_error_ok (&error))
- mono_error_raise_exception (&error);
+ shadow_location = get_shadow_assembly_location_base (data, error);
+ if (!mono_error_ok (error))
+ return NULL;
+
g_free (shadow_location);
#endif
mono_set_pending_exception (mono_get_exception_not_supported ("AppDomain creation is not supported on this runtime."));
return NULL;
#else
- char *fname = mono_string_to_utf8 (friendly_name);
- MonoAppDomain *ad = mono_domain_create_appdomain_internal (fname, setup);
-
+ MonoError error;
+ char *fname;
+ MonoAppDomain *ad;
+
+ fname = mono_string_to_utf8 (friendly_name);
+ ad = mono_domain_create_appdomain_internal (fname, setup, &error);
+
g_free (fname);
+ mono_error_raise_exception (&error);
+
return ad;
#endif
}
}
char *
-mono_make_shadow_copy (const char *filename)
+mono_make_shadow_copy (const char *filename, MonoError *error)
{
+ mono_error_init (error);
return (char *) filename;
}
#else
FIXME bubble up the error instead of raising it here
*/
char *
-mono_make_shadow_copy (const char *filename)
+mono_make_shadow_copy (const char *filename, MonoError *oerror)
{
MonoError error;
gchar *sibling_source, *sibling_target;
guint32 attrs;
char *shadow;
gboolean copy_result;
- MonoException *exc;
struct stat src_sbuf;
struct utimbuf utbuf;
char *dir_name = g_path_get_dirname (filename);
MonoDomain *domain = mono_domain_get ();
char *shadow_dir;
+ mono_error_init (oerror);
+
set_domain_search_path (domain);
if (!mono_is_shadow_copy_enabled (domain, dir_name)) {
if (!mono_error_ok (&error)) {
mono_error_cleanup (&error);
g_free (dir_name);
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy (invalid characters in shadow directory name).");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (invalid characters in shadow directory name).");
+ return NULL;
}
if (strstr (dir_name, shadow_dir)) {
shadow = get_shadow_assembly_location (filename, &error);
if (!mono_error_ok (&error)) {
mono_error_cleanup (&error);
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy (invalid characters in file name).");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (invalid characters in file name).");
+ return NULL;
}
if (ensure_directory_exists (shadow) == FALSE) {
g_free (shadow);
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy (ensure directory exists).");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (ensure directory exists).");
+ return NULL;
}
if (!private_file_needs_copying (filename, &src_sbuf, shadow))
if (GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_PATH_NOT_FOUND)
return NULL; /* file not found, shadow copy failed */
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy (CopyFile).");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy (CopyFile).");
+ return NULL;
}
/* attempt to copy .mdb, .config if they exist */
if (copy_result == FALSE) {
g_free (shadow);
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy of sibling data (CopyFile).");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy of sibling data (CopyFile).");
+ return NULL;
}
/* Create a .ini file containing the original assembly location */
if (!shadow_copy_create_ini (shadow, filename)) {
g_free (shadow);
- exc = mono_get_exception_execution_engine ("Failed to create shadow copy .ini file.");
- mono_raise_exception (exc);
+ mono_error_set_generic_error (oerror, "System", "ExecutionEngineException", "Failed to create shadow copy .ini file.");
+ return NULL;
}
utbuf.actime = src_sbuf.st_atime;
static guint32 WINAPI
unload_thread_main (void *arg)
{
+ MonoError error;
unload_data *data = (unload_data*)arg;
MonoDomain *domain = data->domain;
MonoThread *thread;
/* Have to attach to the runtime so shutdown can wait for this thread */
/* Force it to be attached to avoid racing during shutdown. */
- thread = mono_thread_attach_full (mono_get_root_domain (), TRUE);
+ thread = mono_thread_attach_full (mono_get_root_domain (), TRUE, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
/*
* FIXME: Abort our parent thread last, so we can return a failure