csharp-dotnet-cli-optimization

Diagnose .NET process performance and memory pressure using CLI diagnostics.

2.1k|471|Updated Jul 18, 2013
One-click install
npx skills add https://github.com/MCCTeam/Minecraft-Console-Client --skill csharp-dotnet-cli-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-dotnet-cli-optimization
Source: https://github.com/MCCTeam/Minecraft-Console-Client/tree/main/.skills/csharp-dotnet-cli-optimization
Command: npx skills add https://github.com/MCCTeam/Minecraft-Console-Client --skill csharp-dotnet-cli-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides CLI-first guidance to diagnose and optimize C#/.NET performance problems such as high allocation rates, GC pressure, heap growth, CPU hotspots, blocking/hangs, boxing overhead, and LINQ-related costs without relying on GUI tools.

Core Features & Use Cases

  • Live triage: Use dotnet-counters to detect allocation rates, GC activity, and CPU trends in a running process.
  • Hot-path and stack inspection: Capture dotnet-trace for sampled call paths and dotnet-stack for immediate stack snapshots when a process appears stuck.
  • Heap and postmortem analysis: Collect dotnet-gcdump for heap composition and dotnet-dump for SOS-backed inspection when deeper type-level or postmortem evidence is required.
  • Code guidance and microbenchmarks: Recommend analyzer-backed code patterns and use BenchmarkDotNet for reproducible microbenchmarks when a local change is proposed.

Quick Start

Run dotnet-counters to triage live counters for the target PID, collect a dotnet-trace to find CPU or allocation hot paths, and capture a dotnet-gcdump or dotnet-dump when you need heap or postmortem evidence.

Frequently Asked Questions about csharp-dotnet-cli-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose high memory allocation and GC pressure in a running .NET process?

Diagnose .NET memory pressure by running dotnet-counters to monitor live allocation rates and GC activity for the target process ID. This provides immediate visibility into runtime memory trends without requiring GUI tools.

What CLI commands can I use to capture a heap dump and inspect type composition in C#?

Capture a dotnet-gcdump to analyze heap composition and use dotnet-dump for SOS-backed type-level inspection. These CLI tools provide detailed postmortem evidence of allocated objects and memory structure.

How do I find CPU hotpaths and blocking call stacks when a .NET application hangs?

Find CPU hotpaths and blocking stacks by collecting a dotnet-trace for sampled call paths and running dotnet-stack to capture immediate stack snapshots when the .NET process appears stuck or hung.

Can I use BenchmarkDotNet to verify C# code changes and measure allocation overhead?

Yes, use BenchmarkDotNet to create reproducible microbenchmarks when proposing a local code change. This measures exact allocation overhead and CPU-bound call paths to validate C# performance optimizations.

Does this .NET CLI diagnostics approach work without installing GUI profilers?

Yes, this approach uses CLI-first diagnostic tools including dotnet-counters, dotnet-trace, and dotnet-dump to identify allocation hotspots and deadlocks without relying on or installing GUI profilers.