Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions docs/core/diagnostics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ms.date: 10/20/2023
ms.topic: overview
#Customer intent: As a .NET Core developer I want to find the best tools to help me diagnose problems so that I can be productive.
---
# What diagnostic tools are available in .NET Core?
# Diagnostics in .NET

Software doesn't always behave as you would expect, but .NET Core has tools and APIs that will help you diagnose these issues quickly and effectively.
Software doesn't always behave as you would expect, but .NET has tools and APIs that will help you diagnose these issues quickly and effectively.

[Native AOT deployment](../../core/deploying/native-aot/index.md) is an application model that's been available since .NET 7. For information about .NET 8 diagnostic support for Native AOT apps, see [Native AOT diagnostics](../../core/deploying/native-aot/diagnostics.md).

Expand All @@ -17,9 +17,9 @@ This article helps you find the various tools you need.

[Debuggers](managed-debuggers.md) allow you to interact with your program. Pausing, incrementally executing, examining, and resuming gives you insight into the behavior of your code. A debugger is a good choice for diagnosing functional problems that can be easily reproduced.

## Unit testing
## Profilers

[Unit testing](../testing/index.md) is a key component of continuous integration and deployment of high-quality software. Unit tests are designed to give you an early warning when you break something.
[Profilers](profilers.md) allow you to analyze your program's performance. You can collect data on memory usage, CPU usage, and other metrics to diagnose and understand performance issues.

## Instrumentation for observability

Expand Down Expand Up @@ -50,10 +50,6 @@ There are multiple ways that the instrumentation data can be egressed from the a
- [dotnet-monitor](./dotnet-monitor.md) - an agent for collecting traces and telemetry
- Third-party libraries or app code can read the information from the <xref:System.Diagnostics.Metrics?displayProperty=nameWithType>, <xref:Microsoft.Extensions.Logging.ILogger%601>, and <xref:System.Diagnostics.Activity?displayProperty=nameWithType> APIs.

## Resource monitoring

[Resource monitoring](diagnostic-resource-monitoring.md) is the process of continuously observing and tracking the utilization, performance, and availability of various computing resources within a system. These resources can include hardware components (such as CPUs, memory, disk storage, and network interfaces) as well as software components (like applications and services). Resource monitoring is often used to detect and diagnose performance issues, and to ensure that the system is operating within expected parameters.

## Specialized diagnostics

If debugging or observability is not sufficient, .NET supports additional diagnostic mechanisms such as EventSource, Dumps, DiagnosticSource. For more information, see the [specialized diagnostics](./specialized-diagnostics-overview.md) article.
Expand All @@ -64,10 +60,6 @@ If debugging or observability is not sufficient, .NET supports additional diagno

## .NET Core diagnostics tutorials

### Write your own diagnostic tool

[The diagnostics client library](diagnostics-client-library.md) lets you write your own custom diagnostic tool best suited for your diagnostic scenario. Look up information in the [Microsoft.Diagnostics.NETCore.Client API reference](microsoft-diagnostics-netcore-client.md).

### Debug a memory leak

[Tutorial: Debug a memory leak](debug-memory-leak.md) walks through finding a memory leak. The [dotnet-counters](dotnet-counters.md) tool is used to confirm the leak and the [dotnet-dump](dotnet-dump.md) tool is used to diagnose the leak.
Expand Down Expand Up @@ -95,3 +87,7 @@ If debugging or observability is not sufficient, .NET supports additional diagno
### Measure performance using EventCounters

[Tutorial: Measure performance using EventCounters in .NET](event-counter-perf.md) shows you how to use the <xref:System.Diagnostics.Tracing.EventCounter> API to measure performance in your .NET app.

### Write your own diagnostic tool

[The diagnostics client library](diagnostics-client-library.md) lets you write your own custom diagnostic tool best suited for your diagnostic scenario. For more information, see the [Microsoft.Diagnostics.NETCore.Client API reference](microsoft-diagnostics-netcore-client.md).
20 changes: 20 additions & 0 deletions docs/core/diagnostics/profilers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Profiling tools in .NET
description: An overview of .NET profiling tools.
ms.date: 08/29/2025
---
# .NET profiling tools

Profilers allow you to analyze your program's performance. By analyzing data on memory usage, CPU usage, call stacks and other information, you can better understand the performance profile of your program.

Microsoft provides a profiler with [Visual Studio](/visualstudio/profiling/beginners-guide-to-performance-profiling) and through the [dotnet-trace](dotnet-trace.md) tool.

## Visual Studio profiler

**Visual Studio** is an integrated development environment and an excellent choice for developers working on Windows.

- [Measure app performance in Visual Studio](/visualstudio/profiling/)

## dotnet-trace

[`dotnet-trace`](dotnet-trace.md) is a cross-platform command-line tool that collects diagnostic traces on Windows, Linux, and Mac. You can view these traces in [Visual Studio](/visualstudio/profiling/beginners-guide-to-performance-profiling?#step-2-analyze-cpu-usage-data) or [PerfView](https://github.com/microsoft/perfview).
10 changes: 5 additions & 5 deletions docs/core/diagnostics/specialized-diagnostics-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ If debugging or observability is not sufficient, .NET supports additional diagno

Event Source data can be collected in-process using the <xref:System.Diagnostics.Tracing.EventListener?displayProperty=nameWithType> API or with external diagnostics tools such as [Visual Studio](/visualstudio/profiling), [dotnet-monitor](./dotnet-monitor.md), [dotnet-trace](./dotnet-trace.md), [PerfView](https://github.com/microsoft/perfview), and the [Perfcollect](./trace-perfcollect-lttng.md) scripts. Using the external tools to collect event source data in traces is commonly used for performance analysis.

### Collect diagnostics in containers

The same diagnostics tools that are used in non-containerized Linux environments can also be used to [collect diagnostics in containers](diagnostics-in-containers.md). There are just a few usage changes needed to make sure the tools work in a Docker container.

### EventPipe

[EventPipe](./eventpipe.md) is a runtime component that can be used to collect tracing data, similar to ETW or LTTng. The goal of EventPipe is to allow .NET developers to easily trace their .NET applications without having to rely on platform-specific, OS-native components, such as ETW or LTTng.
Expand All @@ -41,7 +37,11 @@ The .NET runtime exposes a service endpoint that allows other processes to send

## DiagnosticSource & DiagnosticListener

[DiagnosticSource](./diagnosticsource-diagnosticlistener.md) is a module that allows code to be instrumented for production-time logging of rich data payloads for consumption within the process that was instrumented. At run time, consumers can dynamically discover data sources and subscribe to the ones of interest. <xref:System.Diagnostics.DiagnosticSource?displayProperty=nameWithType> was designed to allow in-process tools to access rich data, such as by [OpenTelemetry instrumentation libraries](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/README.md). DiagnosticSource data can also be egressed via EventPipe, which enables rich diagnostic data to be collected by dedicated tools. |
[DiagnosticSource](./diagnosticsource-diagnosticlistener.md) is a module that allows code to be instrumented for production-time logging of rich data payloads for consumption within the process that was instrumented. At run time, consumers can dynamically discover data sources and subscribe to the ones of interest. <xref:System.Diagnostics.DiagnosticSource?displayProperty=nameWithType> was designed to allow in-process tools to access rich data, such as by [OpenTelemetry instrumentation libraries](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/README.md). DiagnosticSource data can also be egressed via EventPipe, which enables rich diagnostic data to be collected by dedicated tools.

## Collect diagnostics in containers

The same diagnostics tools that are used in non-containerized Linux environments can also be used to [collect diagnostics in containers](diagnostics-in-containers.md). There are just a few usage changes needed to make sure the tools work in a Docker container.

## See also

Expand Down
2 changes: 0 additions & 2 deletions docs/navigate/tools-diagnostics/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ landingContent:
url: ../../core/diagnostics/diagnostic-health-checks.md
- text: Exception summary
url: ../../core/diagnostics/diagnostic-exception-summary.md
- text: Resource monitoring
url: ../../core/diagnostics/diagnostic-resource-monitoring.md
- linkListType: reference
links:
- text: Unmanaged API for debugging
Expand Down
6 changes: 4 additions & 2 deletions docs/navigate/tools-diagnostics/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ items:
href: ../../core/diagnostics/index.md
- name: Managed debuggers
href: ../../core/diagnostics/managed-debuggers.md
- name: Profiling tools
href: ../../core/diagnostics/profilers.md
- name: Logging & tracing options
href: ../../core/diagnostics/logging-tracing.md
- name: ILogger Logging
Expand All @@ -377,8 +379,6 @@ items:
href: ../../core/diagnostics/observability-prgrja-example.md
- name: "Example: Use OpenTelemetry with Azure Monitor and Application Insights"
href: ../../core/diagnostics/observability-applicationinsights.md
- name: Resource monitoring
href: ../../core/diagnostics/diagnostic-resource-monitoring.md
displayName: resource monitoring,
- name: App health checks
href: ../../core/diagnostics/diagnostic-health-checks.md
Expand Down Expand Up @@ -423,6 +423,8 @@ items:
href: ../../core/diagnostics/event-counter-perf.md
- name: Compare metric APIs
href: ../../core/diagnostics/compare-metric-apis.md
- name: Resource monitoring
href: ../../core/diagnostics/diagnostic-resource-monitoring.md
- name: Migrate from Windows Performance Counters
href: ../../core/diagnostics/migrate-from-windows-performance-counters.md
- name: Distributed tracing
Expand Down