Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There may be other ways of doing this, but <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a> can tackle this and has a trial version to get you going. It has a very powerful <a href="http://www.ndepend.com/CQL.htm" rel="nofollow noreferrer">Code Query Language</a> which can be used to run sql-like queries against compiled code. From my limited experience, it sounds very suitable to your issue as you can query for code-execution paths and get a graphical representation.</p> <p>You can start with:</p> <pre><code>SELECT METHODS WHERE DepthOfIsUsing "System.Int32.TryParse(String,Int32&amp;)" &gt;= 0 ORDER BY DepthOfIsUsing </code></pre> <p>Executing this query against your assemblies will return all methods that directly and (in your case more importantly) indirectly use "TryParse". This in effect will give you information on those methods which directly use "TryParse" and methods which call these methods, and methods which call those methods, and so on.</p> <p>After running this query in NDepend, you can right-click on the results "n Methods matched" header and select from the context menu "Export n methods matched to Graph". This will give you a graphical representation of all the call trees that end in "TryParse".</p> <p>So for the following code:</p> <pre><code>using System; namespace Scratch { public class Program { private static void Main() { new Test2().DoSomething2("hello"); new Test4().DoSomething4("world"); } } public class Test2 { public void DoSomething2(string s) { new Test3().DoSomething3(s); } } public class Test3 { public void DoSomething3(string s) { int i; Console.WriteLine(int.TryParse(s, out i)); } } public class Test4 { public void DoSomething4(string s) { int i; Console.WriteLine(int.TryParse(s, out i)); } } } </code></pre> <p>The query results are:</p> <p><a href="http://gojisoft.com/_blog/wp-content/uploads/2010/07/CQLTryParseQueryResults.png" rel="nofollow noreferrer">http://gojisoft.com/_blog/wp-content/uploads/2010/07/CQLTryParseQueryResults.png</a></p> <p>And the generated graph is:</p> <p><a href="http://gojisoft.com/_blog/wp-content/uploads/2010/07/DependencyGraphSnapshot.png" rel="nofollow noreferrer">http://gojisoft.com/_blog/wp-content/uploads/2010/07/DependencyGraphSnapshot.png</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload