MemoryLeakDetector.Cli
1.0.3
dotnet tool install --global MemoryLeakDetector.Cli --version 1.0.3
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local MemoryLeakDetector.Cli --version 1.0.3
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MemoryLeakDetector.Cli&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package MemoryLeakDetector.Cli --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MemoryLeakDetector CLI (mld)
A command-line tool for detecting memory leaks, GC pressure issues, and performance problems in .NET projects.
Installation
Install as global tool
dotnet tool install --global --add-source ./nupkg MemoryLeakDetector.Cli
Commands
analyze - Full Roslyn-based analysis
# Analyze current directory
mld analyze .
# Analyze specific directory
mld analyze C:\Projects\MyApp
# With verbose output
mld analyze C:\Projects\MyApp -v
# Save as HTML report (default)
mld analyze C:\Projects\MyApp -o report.html
# Save as Markdown
mld analyze C:\Projects\MyApp -o report.md
# Save as JSON
mld analyze C:\Projects\MyApp -o report.json
scan - Quick regex-based scan
# Quick scan current directory
mld scan .
# Scan specific directory
mld scan C:\Projects\MyApp
# With details
mld scan C:\Projects\MyApp -v
# Save results to file
mld scan C:\Projects\MyApp -o results.txt
Output
Default Report Location
If no -o option is specified, reports are saved to:
analyze:./report.html(in current directory)scan: console output only (use-oto save)
Report Formats
| Extension | Format | Best For |
|---|---|---|
.html |
HTML | Browser viewing, sharing |
.md |
Markdown | GitHub, documentation |
.json |
JSON | CI/CD, automation |
Detected Issues
Memory Leaks (MLD)
| ID | Description |
|---|---|
| MLD001 | HttpClient created per request |
| MLD002 | Disposable field without IDisposable |
| MLD003 | Async void method |
| MLD004 | Timer without IDisposable |
| MLD005 | Static collection may grow unbounded |
| MLD006 | Lambda event subscription |
GC Pressure (GC)
| ID | Description |
|---|---|
| GC001 | String concatenation in loop |
| GC002 | Finalizer detected |
| GC003 | Large array allocation (LOH) |
Performance (PERF)
| ID | Description |
|---|---|
| PERF001 | ToLower/ToUpper for comparison |
| PERF002 | ContainsKey + indexer pattern |
| PERF003 | Non-cached Regex |
Examples
Running from Visual Studio Package Manager Console
# Analyze your solution
dotnet run -- analyze C:\Projects\MySolution
# Quick scan
dotnet run -- scan C:\Projects\MySolution -v
Running as installed tool
mld analyze C:\Projects\MyApp -o C:\Reports\myapp-report.html
mld scan C:\Projects\MyApp -v -o C:\Reports\scan-results.txt
Exit Codes
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | Warnings/issues found |
Requirements
- .NET 8.0 SDK
Troubleshooting
"Path not found" error
- Use full paths:
C:\Projects\MyAppinstead of relative paths - Or use
.for current directory - Check that the path exists
No files analyzed
- Make sure the directory contains
.csfiles - Files in
bin/andobj/folders are automatically excluded
MSBuild errors
- The tool works without MSBuild for basic analysis
- For full project analysis, Visual Studio should be installed
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.