[Mono-list] Creating new appdomain in mono embedding

Salamat, Babak salamat at qualcomm.com
Thu Aug 11 14:59:05 EDT 2011


I have been trying to create a new appdomain in mono embedding, but I have not been successful. In fact, no matter what appdomain I create, on the C# side I get the same appdomain that is initially created by mono_jit_init. Here is what I do:

1. On the C++ side, I initially create an appdomain using mono_jit_init:
MonoDomain* abc_domain = mono_jit_init_version("abc", "v4.0");

2. then I load the assembly using mono_domain_assembly_open and everything works so far.

3. later on I create a new appdomain using mono_domain_create_appdomain and the domain is created successfully:
MonoDomain* xyz_domain = mono_domain_create_appdomain("xyz", NULL);

4. I create new objects in this new domain:
MonoObject* xyz_object = mono_object_new (xyz_domain, MyClass);
mono_runtime_invoke(ctorMethod, xyz_object, args, NULL);

However, on the C# side when I print the AppDomain.CurrentDomain.FriendlyName in the constructor of the xzy_object I still get the "abc" which is the domain initially created by mono_jit_init. I need to create new appdomains to have independent static variables in different domains.

I appreciate it if someone help me resolving this issue and let me know what I am doing incorrectly.

Thanks,
Babak



More information about the Mono-list mailing list