dotnet-trace is a cross-platform performance tracing tool for .NET applications.
It allows developers to collect runtime diagnostic data, such as CPU usage, garbage collection (GC) events, exceptions, thread activity, and performance counters, without needing Visual Studio or Windows-specific tools.

Step 1: Install dotnet-trace

Install the tool globally using .NET CLI:
dotnet tool install --global dotnet-trace

Verify installation:
dotnet-trace --version

Step 2: Collect a Trace

You can start tracing a running .NET process using:

dotnet-trace collect --process-id <PID>

Or directly start and trace a new application:

dotnet-trace collect -- dotnet run

The tool generates a .nettrace file containing all performance data.

Step 3: Convert or Analyze Trace

To analyze or convert the trace file for visualization:

dotnet-trace convert trace.nettrace --format speedscope

Then open it in tools like Speedscope or PerfView.

Step 4: Understanding “?!?” in dotnet-trace Dump

When you view a dotnet-trace dump or trace log, you might see entries containing: ?!?

Meaning:

?!? indicates that symbol resolution failed, which means the tool couldn’t determine the exact method or function name being executed at that point in the trace.

This typically happens when:

  • The application or .NET runtime was built without debugging symbols (PDB files).
  • Symbols are optimized or stripped out in a Release build.

The trace includes external or native code that doesn’t have corresponding metadata.

Essentially, ?!? = “Unknown method or symbol.”

Step 5: How to Fix It

To improve symbol resolution:

Run with Debug Configuration
dotnet build --configuration Debug
Ensure PDB Files Exist
Verify .pdb files are present in the output directory.
Disable Code Optimization (optional)
In your .csproj file:

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
  <Optimize>false</Optimize>
</PropertyGroup>

Use Symbol Servers (for framework code)

You can configure symbol servers in tools like Visual Studio or PerfView to resolve framework method names.

Advantages of Using dotnet-trace

  • Cross-platform performance tracing tool
  • No need to modify or restart applications
  • Lightweight and low-overhead
  • Works on both .NET Core and .NET 6/7/8
  • Integrates with visualization tools (Speedscope, PerfView)

Need Help With .Net Development?

Work with our skilled .Net developers to accelerate your project and boost its performance.

Hire .Net Developers

Support On Demand!

Related Q&A