Introduction

edit

When an application misbehaves on a machine you cannot access, the first questions are always the same: which operating system, which runtime, which culture, which environment variables, how much memory? And when the problem is a hang or a leak, you want to look inside the process at the moment it happened. The Meziantou.Framework.Diagnostics.* packages answer both from inside the application, without installing anything on the machine.

What you can do with them

  • Capture the execution context of the process in one object: operating system, CPU, drives, culture, time zone, process, garbage collector, thread pool, environment variables, AppContext switches and more. Serialize it to JSON and attach it to a bug report or a log. See Context snapshot.
  • Redact secrets from the environment variables of the snapshot. See Sensitive data.
  • Write a memory dump of the current process on Windows, Linux and macOS, when the application detects a problem it cannot explain, and open it in Visual Studio, WinDbg or dotnet-dump. See Memory dumps.
  • Know the platform requirements of a dump: ptrace on Linux and in containers, the get-task-allow entitlement on macOS. See Platform requirements.

Packages

PackageMain typesPages
Meziantou.Framework.Diagnostics.ContextSnapshotContextSnapshotBuilderContext snapshot
Meziantou.Framework.Diagnostics.MemoryDumpMemoryDump, MemoryDumpTypeMemory dumps

The packages are independent: install only the one you need.

Namespaces

Next steps

  • Getting started: install a package, capture a snapshot and write a dump.
  • Logging: the logging packages, to write a snapshot to the logs at startup.