clrmd
Copilot instructions1.2k starsChanged 9 months agoMITView on GitHub
Microsoft.Diagnostics.Runtime (ClrMD) is a .NET library for inspecting crash dumps and live processes. It provides programmatic access to CLR internals (heap, types, threads, GC roots, exceptions) similar to SOS debugging extensions. Important: ClrMD loads architecture-specific native components (DAC), so the test host must match the dump architecture. Use --arch x86 to test 32-bit dumps and --arch x64 for 64-bit. The Test.cmd/test.sh scripts handle this automatically. Dump generation: Tests generate crash dumps lazily on first run — no manual pre-build step…
Trending
Quiet since September.about the whole repository
Who's talking about microsoft/clrmd
- DataDog/dd-trace-dotnet“Update version of ClrMD used by dd-dotnet to support .NET 11”GitHub · Sep 23, 2026 · 1 reactions
- dotnet/diagnostics“Forward ICLRSymbolProvider calls to a host-supplied symbol resolver”GitHub · Jun 12, 2026 · 1 reactions
- dotnet/runtime“[cDAC] Support x86 stackwalking”GitHub · May 28, 2025 · 1 reactions
- dotnet/runtime“[cDAC] Stack Walking”GitHub · Dec 16, 2024 · 1 reactions
- dotnet/fsharp“Add Dump command to VS”GitHub · Mar 19, 2018 · 1 reactions
The biggest 5 of 33 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 33
Talked about on GitHub (33 times).
On GitHub · 33
- Sep 23, 2026Update version of ClrMD used by dd-dotnet to support .NET 11 — DataDog/dd-trace-dotnet1 reaction · 3 comments
- Jun 12, 2026Forward ICLRSymbolProvider calls to a host-supplied symbol resolver — dotnet/diagnostics1 reaction
- May 28, 2025[cDAC] Support x86 stackwalking — dotnet/runtime1 reaction · 12 comments
- Dec 16, 2024[cDAC] Stack Walking — dotnet/runtime1 reaction · 2 comments
- Mar 19, 2018Add Dump command to VS — dotnet/fsharp1 reaction · 10 comments
28 more on GitHub
- Sep 29, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Sep 10, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Sep 8, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Aug 20, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Aug 19, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Jul 22, 2026[main] Update dependencies from microsoft/clrmd — dotnet/diagnostics0 reactions
- Mar 1, 2024Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 3.1.512801 — MGdevSecure4now/winsw_local0 reactions
- Apr 18, 2023Have you ever considered having an extension for ClrMd? — benaadams/Ben.Demystifier0 reactions
- Mar 13, 2023Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.4.416101 — winsw/winsw0 reactions
- Mar 13, 2023Bump Microsoft.Diagnostics.Runtime.Utilities from 2.0.0-rc.20303.3 to 2.4.416101 — winsw/winsw0 reactions
- Mar 1, 2023Bump Microsoft.Diagnostics.Runtime.Utilities from 2.0.256601 to 2.4.412801 — dotdevelop/vs-threading0 reactions
- Mar 1, 2023Bump Microsoft.Diagnostics.Runtime from 2.0.306102 to 2.4.412801 — dotdevelop/vs-threading0 reactions
- Mar 1, 2023Bump Microsoft.Diagnostics.Runtime from 2.0.206203 to 2.4.412801 — paulomorgado/microsoft-vs-threading0 reactions
- Mar 1, 2023Bump Microsoft.Diagnostics.Runtime.Utilities from 2.0.206203 to 2.4.412801 — paulomorgado/microsoft-vs-threading0 reactions
- Feb 1, 2023Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.3.405304 — khang06/osu-framework0 reactions
- Dec 1, 2022Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.2.343001 — LumpBloom7/osu-framework0 reactions
- Dec 1, 2022Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.2.343001 — bl4ckout31/osu-framework0 reactions
- Nov 1, 2022Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.2.343001 — UselessToucan/osu-framework0 reactions
- Jul 1, 2022Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.2.332302 — DavidHusicka/osu-framework0 reactions
- Jun 1, 2022Bump Microsoft.Diagnostics.Runtime from 2.0.226801 to 2.1.327703 — andy840119/osu-framework0 reactions
- Aug 2, 2021Bump Microsoft.Diagnostics.Runtime from 2.0.0-rc.20278.6 to 2.0.226801 in /src/Samples/DumpHeap — aleks-ivanov/clrmd0 reactions
- Aug 2, 2021Bump Microsoft.Diagnostics.Runtime from 2.0.0-rc.20278.6 to 2.0.226801 in /src/Samples/GCRoot — aleks-ivanov/clrmd0 reactions
- Aug 2, 2021Bump Microsoft.Diagnostics.Runtime from 2.0.0-rc.20278.6 to 2.0.226801 in /src/Samples/WindbgExtension — aleks-ivanov/clrmd0 reactions
- Aug 2, 2021Bump Microsoft.Diagnostics.Runtime from 2.0.0-rc.20278.6 to 2.0.226801 in /src/Samples/DumpDict — aleks-ivanov/clrmd0 reactions
- Aug 2, 2021Bump Microsoft.Diagnostics.Runtime from 2.0.0-rc.20278.6 to 2.0.226801 in /src/Samples/ClrStack — aleks-ivanov/clrmd0 reactions
- Aug 2, 2021microsoft/clrmd — pipeline-foundation/projects0 reactions
- Jun 18, 2021Ability to get managed threads handles via DAC API — dotnet/runtime0 reactions · 1 comment
- May 17, 2019Understanding the GCDesc structure — kkokosa/UpsilonGC0 reactions
The file
We split this copilot-instructions.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 89
Prefer is null / is not null over == null / != null.
- Very specific: line 90
Prefer null coalescing (??), null propagation (?.), and pattern matching.
- Very specific: line 98
Test targets are loaded via the TestTargets static class.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for ClrMD
Project Overview
Microsoft.Diagnostics.Runtime (ClrMD) is a .NET library for inspecting crash dumps and live processes. It provides programmatic access to CLR internals (heap, types, threads, GC roots, exceptions) similar to SOS debugging extensions.
Build & Test
# Build the solution (does NOT build test targets or generate dumps):
dotnet build Microsoft.Diagnostics.Runtime.sln
# Run all tests (both 32-bit and 64-bit):
./Test.cmd # Windows
./test.sh # Linux/macOS
# Run only 64-bit or 32-bit tests:
./Test.cmd x64
./Test.cmd x86 # also accepts: x32, arm, amd64, arm64
# Run with a test filter:
./Test.cmd x64 --filter TypeTests
./Test.cmd x86 --filter "FullyQualifiedName~HeapTests.ServerNoCorruption"
# Or use dotnet directly (runs in current process architecture):
dotnet test src/Microsoft.Diagnostics.Runtime.Tests/Microsoft.Diagnostics.Runtime.Tests.csproj
dotnet test src/Microsoft.Diagnostics.Runtime.Tests --filter ClassName=Microsoft.Diagnostics.Runtime.Tests.TypeTestsImportant: ClrMD loads architecture-specific native components (DAC), so the test host must match the dump architecture. Use --arch x86 to test 32-bit dumps and --arch x64 for 64-bit. The Test.cmd/test.sh scripts handle this automatically.
Dump generation: Tests generate crash dumps lazily on first run — no manual pre-build step needed. DumpGenerator.cs in the test project builds test targets for the required architecture and captures dumps automatically:
- .NET Core targets: Built with
dotnet build, dumps captured viaDOTNET_DbgEnableMiniDumpenvironment variables - .NET Framework 4.8 targets (Windows): Built with
dotnet build -f net48, dumps captured via DbgEng
Dumps are cached in src/TestTargets/bin/{x86|x64}/ and reused across test runs. Delete the bin/ directory to force regeneration.
Architecture
Core object model (top-down)
DataTarget → Entry point: loads a crash dump or attaches to a live process
└─ ClrRuntime → One CLR instance within the target
├─ ClrHeap → Managed heap: enumerate objects, segments, roots
│ └─ ClrObject → Single heap object (readonly struct, by address + type)
├─ ClrAppDomain → AppDomains (Desktop CLR) / managed context
├─ ClrModule → Loaded assembly with metadata
│ └─ ClrType → Managed type: fields, methods, base type, interfaces
└─ ClrThread → Thread with stack frames and exception infoDataTargetandClrRuntimeareIDisposable— always useusing.ClrObject,ClrValueType,ClrReferenceare readonly structs (value-type wrappers around an address).ClrHeap,ClrRuntime,ClrTypeimplementations are sealed classes.
Platform abstraction
Platform-specific code lives in src/Microsoft.Diagnostics.Runtime/src/{Windows,Linux,MacOS}/. The IDataReader interface abstracts memory/module reading across:
- Windows:
WindowsProcessDataReader,MinidumpReader - Linux:
CoredumpReader(ELF),LinuxLiveDataReader - macOS:
MachOCoreReader,MacOSProcessDataReader
Key internal layers
AbstractDac/— Platform-independent DAC interface abstractionDacInterface/— COM interop wrappers for the CLR debugging API (DAC)DacImplementation/— Concrete DAC implementationsImplementation/— Type factories, symbol servers, PE image readersDataReaders/—IDataReaderimplementations per format
Projects
- Microsoft.Diagnostics.Runtime — Core library. Multi-targets
netstandard2.0+net10.0. - Microsoft.Diagnostics.Runtime.Utilities — DbgEng COM wrappers. Targets
net10.0. - Microsoft.Diagnostics.Runtime.Tests — xUnit tests. Targets
net10.0. IncludesDumpGenerator.csfor lazy dump creation andTestTargets.csfor loading dumps. - TestTargets (solution folder, not built by default) — Small test programs that crash with unhandled exceptions to produce dumps. Multi-targeted
net10.0;net48. Each target has its own.csprojand referencesSharedLibrary.
Conventions
Naming (enforced by .editorconfig)
- Private/internal fields:
_camelCase - Static private/internal fields:
s_camelCase - Constants:
PascalCase
Code style
- C# latest language version with
unsafeblocks allowed (required for interop). - Nullable reference types are enabled globally.
- Prefer
is null/is not nullover== null/!= null. - Prefer null coalescing (
??), null propagation (?.), and pattern matching. - Max line length: 180 characters.
Test patterns
- Tests use xUnit with
AutoFixture. Test parallelization is disabled globally. - Platform-specific tests use
[WindowsFact],[LinuxFact],[FrameworkFact], or[CoreFact]attributes instead of[Fact].[FrameworkFact]— Only runs on Windows (tests .NET Framework 4.8 dumps, e.g., AppDomains)[WindowsFact]— Only runs on Windows (tests Windows-specific features)
- Test targets are loaded via the
TestTargetsstatic class. Dumps are generated lazily on first access:using DataTarget dt = TestTargets.Types.LoadFullDump(); using ClrRuntime runtime = dt.ClrVersions.Single().CreateRuntime(); - Fixture-based tests use
IClassFixture<ObjectConnection<T>>to share a loaded dump across tests in a class. - Dump file naming:
{TargetName}_{wks|svr}[_mini][_net48].dmp(insrc/TestTargets/bin/{arch}/)
IDisposable
DataTargetandClrRuntimemust be disposed. Check_disposedand throwObjectDisposedExceptionon use-after-dispose.
Immutability
- Heap value wrappers (
ClrObject,ClrValueType,ClrReference) arereadonly structimplementingIEquatable<T>. - Stateful classes (
ClrHeap,ClrRuntime) aresealedwith lazy initialization viaLazy<T>orvolatilefields.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

