Debugging

A stunt you configured carefully that doesn't behave as expected is frustrating, so Stunts is optimized for the debugger: the behaviors configured, the invocations and their results display clearly and concisely.

Here is the RecordingBehavior from Built-in behaviors, showing the calls it recorded and their return values:

RecordingBehavior in the debugger

And an invocation, as an anonymous behavior sees it:

An invocation in the debugger

Name anonymous behaviors to tell them apart in the pipeline:

stunt.AddBehavior((call, next) => next(call, next), name: "pass-through");

RecordingBehavior.ToString() renders every recorded call with its result, one per line, which is handy in test output.

Debugging and profiling the generator

To see the code of a stunt, emit the generated files with <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>: see Compile time and run time.

To step through StuntGenerator during a build, pass -p:DebugStuntGenerator=true (or -p:DebugSourceGenerators=true for all generators) to dotnet build. To measure generation time and cache hit/miss counts, set the STUNTS_PROFILE environment variable to a log file path.