I want to print a list of all the different types loaded into a running .NET process. My plan is to ultimately create a graphical application based on this, so I want to do this from my code, not a third-party tool. I believe that it is best to use MDbgCore to join the current process, and then use MDbgProcess.AppDomains to get CorAppDomain objects and try to shift the object model.
However, I cannot have my life stopped by another process and see any AppDomains. I used the code as follows (which I based on the code from Mike Stoll 's blog )
[MTAThread]
static void Main(string[] args)
{
MDbgEngine debugger = new MDbgEngine();
debugger.Options.StopOnModuleLoad = true;
int pid = Process.GetProcessesByName("VS2010Playground")[0].Id;
MDbgProcess proc = debugger.Attach(pid);
if (proc.IsAlive)
{
proc.AsyncStop().WaitOne();
Console.WriteLine(proc.AppDomains.Count);
if (proc.AppDomains.Count > 0)
{
Console.WriteLine(proc.AppDomains[0].CorAppDomain);
}
}
Console.WriteLine("Done!");
}
Fingerprints:
MDbgPlayground.exe
0
Done!
debugger.Options.Stop *. , . debugger.Options.Trace, MDbg TraceListeners, .
noddy debugger . Visual # 2010, . - ?