Last week, Microsoft released the new CLR Memory Diagnostics (ClrMD) library, which is a set of APIs for programmatically inspecting a crash dump of a .NET program.
To start playing with it, you first need to add the Microsoft.Diagnostics.Runtime package from NuGet (be sure to select Include Prerelease, because it is a prerelease version):
You can use ClrMD to analyze a crash dump from disk, or to attach to a live process. In both scenarios, you will need to use one of the static factory methods declared in the DataTarget class. To analyze a crash dump file from disk, start with the following code:
const string pathToFile = @"C:\TestApplication.DMP";
using (DataTarget dataTarget = DataTarget.LoadCrashDump(pathToFile))
{
// ...
}
Read more: Programming Tidbits
QR: