DumpMiner – UI tool for playing with ClrMD

ClrMD is a library built by Lee Culver. This is a live process and crash dump introspection library.  It allows you to write tools and debugger plugins which can do thing similar to SOS and PSSCOR.

I’m not going to write here about ClrMD, there are plenty of explanations on the net, but I want to talk about tool called DumpMiner I built using ClrMD.

When ClrMD came out, maybe three years ago, I started playing with it and I was very impressed. It gives you fairly easily, with managed code, to build tools which analyze dumps or live process (like WinDbg with SOS).

The main drawback of WinDbg  for .NET developers is the is the need to remember a plenty of commands and when to use each of them is definitely not an easy task.

So after I wrote a few examples with ClrMD, I decided to build a simple UI tool to demonstrate the operations you can do with ClrMD with easy to use UI, just click the operation and you have what you search for.

I think, beside the use you can do with this tool, is also a good start point to learn about ClrMD.

The tool is written in C # and of course with ClrMD and his UI infrastructure built with MUI (Modern UI for WPF) library.

(I must warn you that I do not an expert UI designer, so forgive me about the look of the tool 😉 )

This is not a complete tool, but a small project to work with ClrMD , however he certainly has quite a lot of examples.

Additionally, it was built in a way that you can easily add more ClrMD operations to UI.

Lets see whats inside DumpMiner.

The main classes are:

  • DebuggerSession – Manage the processes of attach\detach, load dump, symbol path, creating runtime etc.
  • ClrObject – Represents a live object from dump or process.
  • IDebuggerOperation – Represents an operation (i.e. dump heap, dump stack, etc.)
  • BaseOperationViewModel – The base view model of operation

There are more, but these are the most important to know.

Operation may looks like this:

public async Task<IEnumerable<object>> Execute(OperationModel model, CancellationToken token, object customeParameter)
    List<string> types = model.Types?.Split(';').ToList();
    return await DebuggerSession.Instance.ExecuteOperation(() =>
        var generation = (int)customeParameter;
        var heap = DebuggerSession.Instance.Heap;
        var results = new List<object>();
        foreach (var obj in heap.EnumerateObjectAddresses().Where(ptr => (generation != -1 && generation == heap.GetGeneration(ptr)) || generation == -1))
            if (token.IsCancellationRequested)

            var type = heap.GetObjectType(obj);
            if (type == null)

            if (types?.Any(t => type.Name.ToLower().Contains(t.ToLower())) ?? true)
                results.Add(new { Address = obj, Type = type.Name, Generation = heap.GetGeneration(obj), Size = type.GetSize(obj) });
        return results;

To add a new operation, you need to write the operation itself, and a user control that you want to represent the results.

For all the rest it’s copy paste from another operation.
For a simple operation, you even not required to write anything except the operation itself.

The operations already implemented:

  • DumpClrStack
  • DumpDelegateMethod
  • DumpDisassemblyMethod
  • DumpExceptions
  • DumpFinalizerQueue
  • DumpGcHandles
  • DumpHeap
  • DumpHeapSegments
  • DumpHeapStat
  • DumpLargeObjetcs
  • DumpMemoryRegions
  • DumpMethods
  • DumpModules
  • DumpObject
  • DumpSyncBlock
  • GetObjectRoot
  • GetObjectSize
  • TargetProcessInfo

There is more that I want to implement among others improvements and capabilities, but I need to find time for this…

To work with this, the process may be like that:

  1. Dump heap to search for type
  2. Dump heap stat to search for type with a lot of instances or in big size
  3. Maybe dump large object heap to search for something that should not be there
  4. Once you have a type, search for specific one. Dump object to see values, Dump size
  5. Maybe dump methods to search for a specific one and investigate is stack objects
  6. When you have a suspect object get is root to check who keep it a live

The interface (as I wrote, I’m not a  great UI designer )


Attach\Detach, Load dump


Dump heap – strings from generation 1


Dump object (string in address 169807932)

BTW, because I use MUI here, you can easily change the UI theme. Check the settings page in the application. For example here is the dark theme version:


I’ll be happy if you try it, and if you love it that great! If something not work, you can contact me for help.

This entry was posted in .NET and tagged , , , , , , , , , , , , , . Bookmark the permalink.

3 Responses to DumpMiner – UI tool for playing with ClrMD

  1. Pingback: Find, Fix, and Avoid Memory Leaks in C# .NET: 8 Best Practices - Michael's Coding Spot

  2. Pingback: How to Create, Use, and Debug .NET application Crash Dumps in 2019 - Michael's Coding Spot

  3. Pingback: [Перевод] Инструментарий для анализа и отладки .NET приложений - Bank News, Банк новости, Седат Игдеджи(Sedat Igdedzhi), Все новости вместе, робот новосте

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.