C# CallStack Analyzer
A Visual Studio Code extension that analyzes and displays the complete call stack for selected C# functions.
Features
- Function Call Stack Analysis: Select any C# function and analyze its complete call stack
- Visual Call Stack Display: View the call hierarchy in a clean, organized webview panel
- Reference Tracking: Automatically finds all references to the selected function
- Multi-file Support: Works across multiple files in your C# project
Installation
- Clone or download this repository
- Open the folder in VS Code
- Run
npm install to install dependencies
- Press
F5 to launch a new VS Code window with the extension loaded
Usage
- Open a C# file in VS Code
- Select a function name (e.g.,
CalculateTotal, ProcessData, etc.)
- Right-click and select "Analyze Call Stack for Selected Function" from the context menu
- The extension will analyze the function and display the complete call stack in a side panel
How It Works
The extension performs the following steps:
- Function Identification: Identifies the selected function in the current file
- Reference Search: Uses VS Code's built-in reference provider to find all usages of the function
- Caller Analysis: For each reference, identifies the containing function/method
- Stack Building: Constructs a hierarchical call stack showing the flow of execution
- Visual Display: Presents the results in an easy-to-read webview panel
Requirements
- VS Code version 1.60.0 or higher
- TypeScript 4.9.4 or higher
- C# project with proper file organization
Development
Building the Extension
npm run compile
Watching for Changes
npm run watch
Testing
- Press
F5 to open a new VS Code window with the extension loaded
- Open a C# file and test the functionality
Configuration
Currently, the extension works out-of-the-box with default settings. Future versions may include configurable options for:
- Call stack depth limits
- File exclusion patterns
- Display formatting options
Limitations
- Works best with well-structured C# code
- May not correctly analyze complex inheritance scenarios
- Requires the C# function to be properly defined and referenced
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
MIT License
| |