0

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?

AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
  • 1
    do you want to check this programatically? During runtime you can use ProcessExplorer to check the AppDomains of an .NET process – Jehof Jun 03 '15 at 08:58

2 Answers2

0

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.

Ricardo Peres
  • 13,724
  • 5
  • 57
  • 74
  • 1
    I stand corrected: it is possible, according to the explanation here: http://stackoverflow.com/questions/388554/list-appdomains-in-process – Ricardo Peres Jun 03 '15 at 10:05
0

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.

sm_
  • 2,572
  • 2
  • 17
  • 34