I have a .Net (C#) process and I want to be able to tell the number of AppDomains that have been created.
How can I do this?
I have a .Net (C#) process and I want to be able to tell the number of AppDomains that have been created.
How can I do this?
You can't, and it probably doesn't make sense. How are these AppDomains being created? If you have control over this, you can add a counter, or add them to a global collection.
Your question sounds like you are investigating something.
You might use a 3rd party memory profiler to check how many instances of AppDomain you have.
It's a big tool for the question you are asking, but it does the trick.
ANTS memory profiler by Red Gate i recommend, i've used it. It shows you the number of instances per Type, and its an amazing tool if you're investigating into some kind of memory leak.