Using a Profiler for inspection
I've gotten some questions about using a profiler to do inspection a managed process. The best blogs to look for on this would be https://blogs.msdn.com/jkeljo and https://blogs.msdn.com/davbr.
The inspection problem obviously intersects between debugging and profiling; here's some key trivia:
1. In V2, ICorDebug and ICorProfiler are now totally disjoint interfaces. We had a concept called "Inproc-Debugging" in V1.0 and V1.1 where you could get an ICorDebug inspection object from the ICorProfiler interfaces (via BeginInprocDebugging). This was removed in V2 and replaced with a profiler-centric inspection API. The MSDN article describes more of the details: https://msdn.microsoft.com/msdnmag/issues/05/01/CLRProfiler/.
2. You can't debug yourself. So you can't try to instantiate ICorDebug on your own process from within a profiler callback. In fact, profiler callbacks are generally very restricted, so don't do anything goofy in them.
Also, here's a comparison of debugger versus profiler services in the CLR. I would personally like to see these interfaces come closer together, but since we've shipped V2, that's a story for the future.