[Mono-dev] Getting the list of all AppDomains in a process

Lionel Cuir lionel_email at aulofee.com
Fri Feb 12 03:44:44 EST 2010

Hi All,
I need to get a list of all loaded AppDomains in the running process
(without asking developer to explicitely register them in a static hashtable
for instance). In .NET on Windows, I can use COM Interop (see code below).
But this is of course unlikely to run in Mono/Linux. Does anybody know how
to do? 
Zoltan, I've read in http://www.mono-project.com/Todo that there would be a
"appdomain ID-indexed tables " => can it be used for this? Where is it?
thks in advance for your ideas
Code to do this with COM Interop on Windows (coming from

// Add the following as a COM reference...

// C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\mscoree.tlb

using System;

using System.Collections;

using System.Runtime.InteropServices;

using mscoree;

public class AppDomainUtils


    public static IList ListAppDomains()


        CorRuntimeHostClass host = new CorRuntimeHostClass();



            ArrayList list = new ArrayList();

            IntPtr enumHandle;

            host.EnumDomains(out enumHandle);



                object domain;

                host.NextDomain(enumHandle, out domain);

                if(domain == null) break;




            return list;








-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100212/a3cbd3bb/attachment.html 

More information about the Mono-devel-list mailing list