Skip to content

Latest commit

 

History

History
41 lines (24 loc) · 1.35 KB

File metadata and controls

41 lines (24 loc) · 1.35 KB

CallGraphTo for csharp Source Files

Displays calls made to a specified method, showing the call graph inbound to the target method.

Overview

This query identifies all call sites that invoke a named method, producing an inbound call graph. Given a target method name, it reports each caller and call location, which is useful for understanding how a method is used across the codebase.

The query accepts method names via an external predicate (targetFunction).

Use Cases

This query is primarily used for:

  • Finding all callers of a specific method
  • Impact analysis before modifying a method signature
  • Understanding usage patterns and entry points

Example

The following C# code demonstrates inbound calls to TargetMethod:

void TargetMethod() {}            // Target method for analysis

void Caller1() { TargetMethod(); }
void Caller2() { TargetMethod(); }

Running with targetFunction = "TargetMethod" produces results showing each call site with the message pattern Call to `TargetMethod` from `Caller1.

Output Format

The query is a @kind problem query producing rows of:

  • select call, "Call to `target` from `caller`"

References