Skip to content
Merged
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
9 changes: 7 additions & 2 deletions docs/core/diagnostics/dotnet-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The `dotnet-trace` tool:

## dotnet-trace collect

Collects a diagnostic trace from a running process.
Collects a diagnostic trace from a running process or launches a child process and traces it (.NET 5+ only). To have the tool run a child process and trace it from its startup, append `--` to the collect command.

### Synopsis

Expand All @@ -77,6 +77,7 @@ dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--
[--format <Chromium|NetTrace|Speedscope>] [-h|--help]
[-n, --name <name>] [--diagnostic-port] [-o|--output <trace-file-path>] [-p|--process-id <pid>]
[--profile <profile-name>] [--providers <list-of-comma-separated-providers>]
[--show-child-io]
[-- <command>] (for target applications running .NET 5.0 or later)
```

Expand Down Expand Up @@ -181,6 +182,10 @@ dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--
> [!NOTE]
> Using this option monitors the first .NET 5.0 process that communicates back to the tool, which means if your command launches multiple .NET applications, it will only collect the first app. Therefore, it is recommended you use this option on self-contained applications, or using the `dotnet exec <app.dll>` option.

- **`--show-child-io`**

Shows the input and output streams of a launched child process in the current console.

> [!NOTE]
> Stopping the trace may take a long time (up to minutes) for large applications. The runtime needs to send over the type cache for all managed code that was captured in the trace.

Expand Down Expand Up @@ -300,7 +305,7 @@ Press <Enter> or <Ctrl+C> to exit...
You can stop collecting the trace by pressing `<Enter>` or `<Ctrl + C>` key. Doing this will also exit `hello.exe`.

> [!NOTE]
> Launching `hello.exe` via dotnet-trace will make its input/output to be redirected and you won't be able to interact with its stdin/stdout.
> Launching `hello.exe` via dotnet-trace will redirect its input/output and you won't be able to interact with it on the console by default. Use the `--show-child-io` switch to interact with its stdin/stdout.
> Exiting the tool via CTRL+C or SIGTERM will safely end both the tool and the child process.
> If the child process exits before the tool, the tool will exit as well and the trace should be safely viewable.

Expand Down