Questions tagged [clrmd]

CLRMD is a managed library for analysis of crash dumps or live processes regarding .NET internals.

Microsoft Diagnostics Runtime Component (or short CLRMD) is a wrapper around the CLR internal-only debugging APIs. Is a managed code library for programmatical analysis of crash dumps or live processes and allows automating tasks which could otherwise be achived by WinDbg plugins SOS or SOSEX.

More info and code examples can be found here

35 questions
7
votes
2 answers

ClrMd throws exception when creating runtime

I am using the CLR Memory Diagnostics library to get the stack trace of all threads in a running process: var result = new Dictionary(); var pid = Process.GetCurrentProcess().Id; using (var dataTarget =…
Drake
  • 2,679
  • 4
  • 45
  • 88
6
votes
2 answers

Attach to self with ClrMD? HRESULT: 0x80070057

I'm trying to attach the ClrMD in a process to itself: private static void Main() { var pid = Process.GetCurrentProcess().Id; WriteLine($"PID: {pid}"); using (var dataTarget = DataTarget.AttachToProcess(pid, 1000)) { …
BanksySan
  • 27,362
  • 33
  • 117
  • 216
6
votes
0 answers

Is there an equivalent of CLR Memory Diagnostic (CLRMD) for Mono?

The title is quite explicit: is there an equivalent of CLRMD for Mono, or at least any way to non-invasively read the heap of an external Mono process in order to get the list of all allocated objects and read their fields ? If there is no such…
Fitz
  • 570
  • 1
  • 5
  • 23
6
votes
2 answers

"Failure loading DAC: CreateDacInstance failed" when loading dump file with ClrMD

I'm trying the new library from microsoft, ClrMD, to analyze crash-dumps and live process. I've follow the sample in the .NET Framework blog post (using the attached .cs file). I tried to run the sample to analyze a .dmp file which was taken from a…
avivr
  • 2,573
  • 3
  • 22
  • 34
5
votes
1 answer

How to properly work with non-primitive ClrInstanceField values using ClrMD?

I've got some really large memory dumps of a managed process that I'm trying to get a lot of statistics from--as well as be able to present an interactive view of--fairly deep object graphs on the heap. Think something comparable to !do
TheXenocide
  • 1,060
  • 8
  • 22
4
votes
0 answers

Define current size of thread pool in .NET

I want to know the number of active threads (iocp and worker) in threadpool. I use this technique: ThreadPool.GetAvailableThreads(out var workerAvailable, out var iocpAvailable); ThreadPool.GetMinThreads(out var workerMin, out var…
mtkachenko
  • 5,389
  • 9
  • 38
  • 68
4
votes
1 answer

How do I get information about the methods in StackTrace using Microsoft.Diagnostics.Runtime?

Code: using System.Diagnostics; using System.Linq; using Microsoft.Diagnostics.Runtime; using Microsoft.Diagnostics.Runtime.Utilities; using Microsoft.Diagnostics.Runtime.Utilities.Pdb; namespace myDiagnostics { public class myStackTraceInfo …
Евгений
  • 125
  • 1
  • 8
4
votes
1 answer

What's the ip2md equivalent in ClrMD

I know how to iterate the object in the memory, but I'm about to do something with ClrMD as the !ip2md command in WinDBG/SOS. What exactly should I do?
Jeffrey Zhao
  • 4,923
  • 4
  • 30
  • 52
4
votes
1 answer

Trying to find object roots using CLR MD

Here is my class namespace MyNamespace { public class MyClass { private byte[] imageBytes = null; public MyClass() { } public void LoadImage(string filePath) { Image img =…
paul deter
  • 857
  • 2
  • 7
  • 20
3
votes
1 answer

ClrMD: analyze dump of .NET framework process in dotnet core application

I have a dump of .NET framework application created using procdump. I can create console .NET framework 4.6.1 application, install ClrMd nuget package and write this code to start some inspections: using(var dt =…
mtkachenko
  • 5,389
  • 9
  • 38
  • 68
3
votes
0 answers

How do I get the Thread "Location"/StackTrace in Code?

I have this code (using CLRMD) currently to attempt to get the stacktrace: var pid = Process.GetCurrentProcess().Id; using (var dataTarget = DataTarget.AttachToProcess(pid, 5000, AttachFlag.Passive)) { ClrInfo currentRuntime =…
Thomas
  • 555
  • 7
  • 29
3
votes
1 answer

Can DebugDiag generate reports with "inclusive size" like Visual Studio 2013

Visual Studio 2013 can show a column for inclusive size (which includes size of child objects) - http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx DebugDiag's memory analysis…
sgarg
  • 2,340
  • 5
  • 30
  • 42
3
votes
1 answer

Is there any way to get the values of local variables (like sosex !mdv) with ClrMD?

Using windbg with SOS and SOSEX, I can use the !mdv command which "Displays arguments and locals for a managed frame". Is there any way to achieve the same results programmatically with ClrMD?
Omer Raviv
  • 11,409
  • 5
  • 43
  • 82
2
votes
0 answers

How to get the custom attributes of a method?

Assuming we have a method defined as below. public class SomeClass { [My("beautifulName")] public void DoSomeThing() { // whatever. } } public MyAttribute : Attribute { public string Name { get; init; } public…
Ruikuan
  • 31
  • 5
2
votes
2 answers

powershell - struggling to reference DLL that is not in GAC

I'm trying (and failing) to load a DLL (not in GAC) into powershell. The DLL is part of the Microsoft.Diagnostics.Runtime (ClrMD) Nuget Package See the full documentation for Microsoft.Diagnostics.Runtime. The reason why i cant get it into GAC is…
g0pher
  • 59
  • 8
1
2 3