Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4235568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:31:00+00:00 2026-05-21T02:31:00+00:00

Given a DLL file, I’d like to be able to find all the calls

  • 0

Given a DLL file, I’d like to be able to find all the calls to a method within that DLL file. How can I do this?

Essentially, how can I do programmatically what Visual Studio already does?

I don’t want to use a tool like .NET Reflector to do this, but reflection is fine and probably necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:31:01+00:00Added an answer on May 21, 2026 at 2:31 am

    To find out where a method MyClass.Foo() is used, you have to analyse all classes of all assemblies that have a reference to the assembly that contains MyClass. I wrote a simple proof of concept of how this code can look like. In my example I used this library (it’s just a single .cs file) written by Jb Evain:

    I wrote a little test class to analyse:

    public class TestClass
    {
        public void Test()
        {
            Console.WriteLine("Test");
            Console.Write(10);
            DateTime date = DateTime.Now;
            Console.WriteLine(date);
        }
    }
    

    And I wrote this code to print out all the methods used within TestClass.Test():

    MethodBase methodBase = typeof(TestClass).GetMethod("Test");
    var instructions = MethodBodyReader.GetInstructions(methodBase);
    
    foreach (Instruction instruction in instructions)
    {
        MethodInfo methodInfo = instruction.Operand as MethodInfo;
    
        if(methodInfo != null)
        {
            Type type = methodInfo.DeclaringType;
            ParameterInfo[] parameters = methodInfo.GetParameters();
    
            Console.WriteLine("{0}.{1}({2});",
                type.FullName,
                methodInfo.Name,
                String.Join(", ", parameters.Select(p => p.ParameterType.FullName + " " + p.Name).ToArray())
            );
        }
    }
    

    It gave me the following output:

    System.Console.WriteLine(System.String value);
    System.Console.Write(System.Int32 value);
    System.DateTime.get_Now();
    System.Console.WriteLine(System.Object value);
    

    This example is obviously far from complete, because it doesn’t handle ref and out parameters, and it doesn’t handle generic arguments. I am sure that forgot about other details as well. It just shows that it can be done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following: string file = @c:\somepath\somefile.dll; How can I find the file and
Given a package, how can I automatically find all its sub-packages?
By running System.loadLibrary(myAPI) , I verified that the DLL file myAPI.dll can be successfully
Given a file, I want to check if this is a DLL, or a
Given that I have a file in path: C:\Applications\General Utils\Assembly1\Assembly1\Bin\Debug\Assembly1.dll and I am working
How can I get the list of all DLL dependencies of a given DLL
I'm writing a program that among other things needs to download a file given
I need to detect whether a given .dll or .exe file is 32 bit
Given: - an assembly (e.g. SomeLib.dll) - a text file (e.g. myconfig.xml) I need
How do you determine whether a given exe or dll or sys file is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.