.NET Memory Profiling
.NET Continuous Profiler: Exception and lock contention | Datadog

.NET Continuous Profiler: Exception and lock contention | Datadog

4/4/2024 · Christophe Nasarre

What this post added

This post details the implementation of exception and lock contention profiling within Datadog's .NET continuous profiler. For exceptions, it describes how to capture exception type, thread ID, and message by leveraging `ICorProfilerCallback::ExceptionThrown` and accessing internal exception fields like `_message`. For lock contention, it explains how to use CLR events (`ContentionStart`, `ContentionStop`) and the `EventPipeEventDelivered` callback to track lock contention duration and identify the holding thread, with specific considerations for different .NET runtime versions.

Read the original post ↗