[Mono-dev] Error handling for embedded Mono

luke at quinane.id.au luke at quinane.id.au
Thu Nov 30 20:10:15 EST 2006

Hi All,

I was looking at embedding Mono into a project and noticed that in several
places Mono simply calls exit(-1) when it has a problem. This is obviously
not a very good solution for a project that is running embedded Mono; a
nicer solution would be to return an error code that could be handled by
the host program.

I had a look at making some changes to remove some of these calls but ran
into some problems. For example mono_init_internal calls exit (line 586 of
domain.c) but by that point the domain has been allocated and a lot of
things have been initialized. So my question is how does Mono handle such
errors? Is it possible to return NULL for the domain and just call

Also should mono_runtime_run_main (in object.c) set
mono_environment_exitcode_set and return -1 instead of calling exit?



More information about the Mono-devel-list mailing list