How do I get all INSTANCES (yes, I mean instances) existing within a specific process or AppDomain? Is it any way to do that (even go through heap)?
Asked
Active
Viewed 331 times
3
-
you can do that - either you implement your classes accordingly (they could manage a static list of instances...) OR you hook the CLR (C++ needed) and load the process into that "hooked CLR"... – Yahia Aug 17 '11 at 13:45
-
Specific process - it's mean any proces from windows shell. I want to browse instances from other .NET processes (sth like debugger's do). – fakir314 Aug 17 '11 at 13:49
-
There's some related answers [here](http://stackoverflow.com/questions/302542/how-do-i-get-all-instances-of-all-loaded-types-that-implement-a-given-interface) but I'm not sure they'll help you get the instances you're after. – Xav Aug 17 '11 at 13:49
-
then you need to hook the CLR and configure the system in a way that .NET-processes you want to examine are started using "your" CLR... – Yahia Aug 17 '11 at 13:50
-
@Xav - Yes, there ist realted question, but answer is in diffrent matter. Answer is about all types in AppDomain. I need instances of types. – fakir314 Aug 17 '11 at 13:57
-
4Why are you trying to do this? There's probably an easier way to accomplish what you're trying to do. – John Saunders Aug 17 '11 at 13:58
-
@fakir: this is really complicated and a lot of work... it means writing some sort of runtime debugger with some features similar to a memory profiler and what Intellitrace does in the big VS version... why do you want to do this ? – Yahia Aug 17 '11 at 14:03
-
@John Saunders - I've met problem to change some program in evnviroment with no Visual Studio and others. So I think - it may be good idea to examine all process objects, dynamically creates new ones and injects it into an others. – fakir314 Aug 17 '11 at 14:03
-
@Yahia - something in this way, i know it is a lot of work. Funny, but I'm stuck at begin :) – fakir314 Aug 17 '11 at 14:04
-
that goes far beyond some link or some lines of code... check for available info on hooking CLR (for example on MSDN etc.) and come back with spcific questions – Yahia Aug 17 '11 at 14:10
-
1You should attach a debugger to the process. – John Saunders Aug 17 '11 at 14:12