"Find All References" programmatically

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi

I'm working on some code verification tools, and I'd like to implement
pretty much the same functionality as the VS 2005 "Find All References" menu
option, in c#.

I want my code to run through some other code (or possibly the compiled
modules) that my colleagues and I have written, and find calls to specific
functions (also in our code), in such a way that I can get hold of the
parameters of the calls. I don't really want to write this as a VS add-in,
I want it to be part of the unit tests.

I've looked through the MSDN, but nothing jumps out at me as an obvious
approach. Reflection doesn't look like it would do the job (at least not
easily). I've even considered using Regex, but I'd rather examine the
compiled code than the text, if that's possible.

I've also seen the same functionality in .NET Reflector, in the Analyzer
window.

I'd be grateful for any pointers you can give me.

Cheers

Jason
 
Reflection would do the job and you are right, it won't
be an easy thing to write (a comphrensive tool that is).
 
Robbe Morris said:
Reflection would do the job and you are right, it won't
be an easy thing to write (a comphrensive tool that is).

Hi Robbe

Thanks for your help. I've already written some code using reflection that
can run through assemblies and work out that there are, say 2 classes X and
Y, which have member functions X.f() and Y.g() respectively.

I don't suppose there's an easy way to find out whether X.f() calls into
Y.g() at all?

Thanks

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top