Application domains are used to isolate multiple applications on a single Mono virtual machine. They are conceptually similiar to processes, the difference is that processes are managed by the operating system, while application domains are managed by the Mono virtual machine.
For more information on applications domains see the AppDomain FAQ.
The MonoDomain is the unmanaged representation of the System.AppDomain managed type, while the MonoAppDomain type represents the managed version (MonoAppDomain has a pointer to a MonoDomain).
mono_domain_assembly_open
| domain | the application domain |
| name | file name of the assembly |
mono_domain_create
MonoDomain, with no configuration or assemblies
loaded into it.Creates a new application domain, the unmanaged representation of the actual domain.
Application domains provide an isolation facilty for assemblies. You can load assemblies and execute code in them that will not be visible to other application domains. This is a runtime-based virtualization technology.
It is possible to unload domains, which unloads the assemblies and data that was allocated in that domain.
When a domain is created a mempool is allocated for domain-specific structures, along a dedicated code manager to hold code that is associated with the domain.
mono_domain_create_appdomain
| friendly_name | The friendly name of the appdomain to create |
| configuration_file | The configuration file to initialize the appdomain with |
MonoDomain initialized with the appdomain
mono_domain_finalize
| domain | the domain to finalize |
| timeout | msecs to wait for the finalization to complete, -1 to wait indefinitely |
TRUE if succeeded, FALSE if there was a timeout
Request finalization of all finalizable objects inside domain. Wait timeout msecs for the finalization to complete.
mono_domain_foreach
| func | function to invoke with the domain data |
| user_data | user-defined pointer that is passed to the supplied func fo reach domain |
Use this method to safely iterate over all the loaded application
domains in the current runtime. The provided func is invoked with a
pointer to the MonoDomain and is given the value of the user_data
parameter which can be used to pass state to your called routine.
mono_domain_free
| domain | the domain to release |
| force | if TRUE, it allows the root domain to be released (used at shutdown only). |
This releases the resources associated with the specific domain. This is a low-level function that is invoked by the AppDomain infrastructure when necessary.
In theory, this is dead code on netcore and thus does not need to be ALC-aware.
mono_domain_from_appdomain
mono_domain_get_by_id
| domainid | the ID |
mono_domain_get_friendly_name
NULL if not yet set.
The returned string's lifetime is the same as domain's. Consider copying it if you need to store it somewhere.
mono_domain_get_id
A domain ID is guaranteed to be unique for as long as the domain using it is alive. It may be reused later once the domain has been unloaded.
mono_domain_get
This method returns the value of the current MonoDomain that this thread
and code are running under. To obtain the root domain use
mono_get_root_domain API.
mono_domain_has_type_resolve
| domain | application domain being looked up |
TRUE if the AppDomain.TypeResolve field has been set.
mono_domain_is_unloading
mono_domain_owns_vtable_slot
mono_domain_set_config
| domain | MonoDomain initialized with the appdomain we want to change |
| base_dir | new base directory for the appdomain |
| config_file_name | path to the new configuration for the app domain |
Used to set the system configuration for an appdomain
Without using this, embedded builds will get 'System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.' for some managed calls.
mono_domain_set_internal
| domain | the new domain |
Sets the current domain to domain.
mono_domain_set
| domain | domain |
| force | force setting. |
TRUE on success; FALSE if the domain is unloaded
Set the current appdomain to domain. If force is set, set it even if it is being unloaded.
mono_domain_try_type_resolve
| domain | application domain in which to resolve the type |
| name | the name of the type to resolve or NULL. |
| typebuilder | A System.Reflection.Emit.TypeBuilder, used if name is NULL. |
MonoReflectionAssembly or NULL if not found
This routine invokes the internal System.AppDomain.DoTypeResolve and returns
the assembly that matches name, or ((TypeBuilder)typebuilder).FullName.
mono_domain_try_unload
mono_domain_unload
| domain | The domain to unload |
| exc | Exception information |
Unloads an appdomain. Follows the process outlined in: http://blogs.gotdotnet.com/cbrumme
If doing things the 'right' way is too hard or complex, we do it the 'simple' way, which means do everything needed to avoid crashes and memory leaks, but not much else.
It is required to pass a valid reference to the exc argument, upon return from this function *exc will be set to the exception thrown, if any.
If this method is not called from an icall (embedded scenario for instance), it must not be called with any managed frames on the stack, since the unload process could end up trying to abort the current thread.
mono_context_init
| domain | The domain where the System.Runtime.Remoting.Context.Context is initialized |
System.Runtime.Remoting 's Context.mono_context_get
mono_context_get_domain_id
| context | the context to operate on. |
mono_context_get_id
| context | the context to operate on. |
Context IDs are guaranteed to be unique for the duration of a Mono process; they are never reused.
mono_context_set