I am trying to retrieve all direct indirect method calls for all methods in an assembly using the CQL provided by nDepend.
Issue is I am not able to iterate through all methods inside a assembly to get this info.
The DepthOfIsUsedBy only allows a string type and not a collection of strings.
Is there a way t get this info for all methods inside an assembly?
What about using the method DepthOfIsUsing() instead of DepthOfIsUsedBy() :o)
from m in Assemblies.WithNameNotIn("nunit.uikit").ChildMethods()
let depth0 = m.DepthOfIsUsing("nunit.uikit")
where depth0 >= 0 orderby depth0
select new { m, depth0 }
This query has been generated through the menu below. (Btw a more sophisticated solution could be elaborated with the magic method FillIterative(), but it is not necessary here).
Taking account the comment of Prasad, what about trying this query that list all direct & indirect callers from A, for each method of B:
from m in Assemblies.WithNameIn("AsmB").ChildMethods()
where m.IsPubliclyVisible // Optimization
let indirectcallers = m.MethodsCallingMe
.FillIterative(
callers => callers.SelectMany(m1 => m1.MethodsCallingMe))
.DefinitionDomain
.Where(m1 => m1.ParentAssembly.Name == "AsmA")
.ToArray() // Avoid double enumeration
where indirectcallers.Length > 0
orderby indirectcallers.Length descending
select new { m, indirectcallers }