dotprof 1.3.0

dotnet tool install --global dotprof --version 1.3.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotprof --version 1.3.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotprof&version=1.3.0
                    
nuke :add-package dotprof --version 1.3.0
                    

<div align="center">

dotprof

Inject trace logs for AI Coding Agents

dotprof

</div>

dotprof is a tracing and profiling tool optimized for AI coding agents.

There are similar tools such as dotnet-trace, dotnet-stack, strace, dotTrace, dntrace, etc, but existing tools are too sophisticated in the AI era.

dotprof can inject traces to Unity assemblies. See Unity Integration.

Sample Output

Without having to read the AI-generated code, you can easily understand the execution flow correctness, bottlenecks, etc.

Then you just paste the output, add your review comments, and say "do it".

├─┬ Sandbox.<Main>
│ │   + System.String[]
│ ├─┬ Sandbox.Main
│ │ │   + System.String[]
│ │ ├─┬ <Main>d__0..ctor
│ │ │ └ <Main>d__0..ctor
│ │ │     0.31ms, 0.00s total, alloc ~= 8224 B
│ │ ├─┬ <Main>d__0.MoveNext
│ │ │ ├─┬ Sandbox.NoArgs
│ │ │ │ └ Sandbox.NoArgs
│ │ │ │     0.0139ms, 0.01s total, alloc ~= 8224 B
│ │ │ ├─┬ Sandbox.Branch_WithoutReturn
│ │ │ │ │   + True
│ │ │ │ ├─┬ Sandbox.<Branch_WithoutReturn>g__true_branch|6_0
│ │ │ │ │ └ Sandbox.<Branch_WithoutReturn>g__true_branch|6_0
│ │ │ │ │     0.0004ms, 0.01s total, alloc ~= 0 B
│ │ │ │ └ Sandbox.Branch_WithoutReturn
│ │ │ │     0.0521ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Sandbox.Branch_WithoutReturn
│ │ │ │ │   + False
│ │ │ │ ├─┬ Sandbox.<Branch_WithoutReturn>g__false_branch|6_1
│ │ │ │ │ └ Sandbox.<Branch_WithoutReturn>g__false_branch|6_1
│ │ │ │ │     0.0003ms, 0.01s total, alloc ~= 0 B
│ │ │ │ └ Sandbox.Branch_WithoutReturn
│ │ │ │     0.0443ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Sandbox.Branch_WithReturn
│ │ │ │ │   + True
│ │ │ │ ├─┬ Sandbox.<Branch_WithReturn>g__true_branch|7_0
│ │ │ │ │ └ Sandbox.<Branch_WithReturn>g__true_branch|7_0
│ │ │ │ │     0.0003ms, 0.01s total, alloc ~= 0 B
│ │ │ │ └ Sandbox.Branch_WithReturn
│ │ │ │     0.0473ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Sandbox.Branch_WithReturn
│ │ │ │ │   + False
│ │ │ │ ├─┬ Sandbox.<Branch_WithReturn>g__false_branch|7_1
│ │ │ │ │ └ Sandbox.<Branch_WithReturn>g__false_branch|7_1
│ │ │ │ │     0.0003ms, 0.01s total, alloc ~= 0 B
│ │ │ │ └ Sandbox.Branch_WithReturn
│ │ │ │     0.0428ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Foo..cctor
│ │ │ │ └ Foo..cctor
│ │ │ │     0.0004ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Foo.Alloc1KiB
│ │ │ │ └ Foo.Alloc1KiB
│ │ │ │     0.0001ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Foo.Alloc1KiB
│ │ │ │ └ Foo.Alloc1KiB
│ │ │ │     0.0043ms, 0.01s total, alloc ~= 8224 B
│ │ │ ├─┬ Foo.Alloc1KiB
│ │ │ │ └ Foo.Alloc1KiB
│ │ │ │     0.0001ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Foo.Alloc1KiB
│ │ │ │ └ Foo.Alloc1KiB
│ │ │ │     0.0002ms, 0.01s total, alloc ~= 0 B
│ │ │ ├─┬ Sandbox.CI_fails_if_stdout_doesnt_include_this__2255201d_4e66_4fb0_b0c0_f1ee1c005c61
│ │ │ │ └ Sandbox.CI_fails_if_stdout_doesnt_include_this__2255201d_4e66_4fb0_b0c0_f1ee1c005c61
│ │ │ │     0.0003ms, 0.01s total, alloc ~= 0 B
│ │ │ └ <Main>d__0.MoveNext
│ │ │     0.7479ms, 0.01s total, alloc ~= 16448 B
│ │ └ Sandbox.Main
│ │     5.9545ms, 0.01s total, alloc ~= 24672 B
│ └ Sandbox.<Main>
│     6.2356ms, 0.01s total, alloc ~= 24672 B

Arguments and Performance Metrics

  • +: Method arguments. Override ToString to customize string representation.
  • Milliseconds: Method, property or constructor execution duration.
  • Total seconds: Elapsed time from app start (technically, it's from static field initialization).
  • Allocation: Delta value of GC.GetTotalMemory from method start.
    • It's a total, not per-method allocation - new byte[1024] takes 8,224 bytes at once.

Basic Usage

# Install as a global tool
dotnet tool install -g dotprof

# Or, use with dnx
dnx -y dotprof -- [args]

# Inject traces to current repo
dotprof --framework net10.0

# Inject traces to only members whose full name has Foo or Bar
dotprof -f net10.0 --targets Foo,Bar

Test Mode

Inject and view traces using dotnet test without complicated setups.

# Usage ('-' is a delimiter)
dotprof test -f <framework> [options] - [args]

# Example
dotprof test -f net10.0 - --filter Name~Foo

    # Automatically run the following commands
    dotprof -f net10.0
    dotnet test -f net10.0 --filter Name~Foo

CLI Mode

Build and inject traces and then run resulting .dll with dotnet <dll> [args].

# Usage: Inject options and CLI arguments are separated by '-'
dotprof -f <framework> [options] - [args]

# Example: Build ./src and run with args 'foo --bar=baz'
dotprof -f net10.0 -p ./src - foo --bar=baz

Unity Integration

You can inject traces with custom logger such as UnityEngine.Debug.Log.

dotprof -f netstandard2.1 --logger UnityEngine.Debug.Log -p foo.dll

Logger method signature must be void Method(object).

TODO

unity Sub Command

dotprof unity [--logger <logger-name>] <dll-path-1> [ <dll-path-2> ... ]

# Lowered to (--logger default: UnityEngine.Debug.Log):
dotprof -f netstandard2.1 --logger <logger-name> -p <dll-path-1>
dotprof -f netstandard2.1 --logger <logger-name> -p <dll-path-2>
...

Technical Note

Injection Exemption

override string ToString is exempted from injection.

Console Encoding Override

Injected traces force set Console.OutputEncoding to Encoding.UTF8.

Async Method Traces

Especially for cli tool (Console.WriteLine), trace logs may appear in incorrect order.

You need to use custom thread-safe logger to prevent writing to same console buffer concurrently from multiple threads.

Troubleshooting

Trace logs not appear in console

Try run dotprof once again.

First-time execution may not work as expected (help wanted).

Failed to read environment variable [DOTNET_STARTUP_HOOKS], HRESULT: 0x80070002

If this error occurs even if you didn't set, run:

set DOTNET_STARTUP_HOOKS=

NOTE: It is not set in this tool. Not sure why this happens.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.3.0 118 7/10/2026
1.3.0-rc.1 60 7/10/2026
1.2.0 104 7/7/2026
1.2.0-rc.1 61 7/7/2026
1.1.0 101 7/4/2026
1.0.2 104 7/2/2026
1.0.1 95 7/2/2026
1.0.0 102 7/1/2026
1.0.0-rc.4 60 6/30/2026
1.0.0-rc.3 56 6/30/2026
1.0.0-rc.2 58 6/30/2026
1.0.0-rc.1 61 6/28/2026