[Mono-list] a way to find all classes, and methods for certain application domain?

Robert Jordan robertj at gmx.net
Thu Aug 24 05:38:02 EDT 2006

Okehee Goh wrote:
> Hello,
> Is there a way to find all classes, and methods for certain application
> domain?
> My  test application  hosts multiple  application domain for different
> assemblies.
> I'd like to check the classes loaded for certain assembly of a certain
> domain. The classes' list should show all system class libraries loaded for
> the assembly, too.
> I checked output from --profile option with a profile argument 'time', 
> which
> shows the performance of method compilation.
> The user classes defined in the specific assembly may be distinguished by
> using a different namespace from the profile output. But, I don't know how
> to find system class libraries loaded for the assembly?

If you can afford to load the appdomain's assemblies
into the root domain as well, you could enum the
assemblies with this code:

foreach (Assembly asm in someAppDomain.GetAssemblies ())
	do something with asm

This works best, if all assemblies are in the same dir,
otherwise ... you could use AppDomain.DoCallback instead:


class AssemblyEnumerator : MarshalByRefObject
         public ArrayList FileNames = new ArrayList ();

         public void Callback ()
                 foreach (Assembly asm in 
AppDomain.CurrentDomain.GetAssemblies ()) {
                         FileNames.Add (asm.Location);

AssemblyEnumerator ae = new AssemblyEnumerator ();
someAppDomain.DoCallBack (new CrossAppDomainDelegate(ae.Callback));
foreach (string file in ae.FileNames)
	Console.WriteLine (file);

After you got the assembly (or the assembly file name)
you could enumerate its types and their members either
using System.Reflection or you could just invoke monodis
on the assembly file name ...


More information about the Mono-list mailing list