dotnet-tarp 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global dotnet-tarp --version 0.1.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 dotnet-tarp --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-tarp&version=0.1.0
                    
nuke :add-package dotnet-tarp --version 0.1.0
                    

McDcTestCoverage

Tarp is a test coverage measurement tool for C#.

MC/DC

Tarp measures masking MC/DC (modified condition/decision coverage) of the code your tests run.

In an existing solution

Install the tool and run your tests through it:

dotnet tool install -g dotnet-tarp   # from nuget.org, once a release is published there
dotnet tarp test                     # takes the same arguments as dotnet test

Without nuget.org, download dotnet-tarp.<version>.nupkg from a GitHub release into a directory and add --add-source <directory> to the install command. dotnet pack Tarp.BuildTool makes the package from a checkout.

No change to the projects is needed. dotnet tarp test runs dotnet test with Tarp.BuildTool/Tarp.targets imported into every project of the build, then prints the report. For each C# project that isn't a test project, right before it compiles:

  1. Tarp builds the same compilation the compiler is about to build (sources, references, defines, language version, source generators), rewrites every decision (&&/||/! expressions, and the conditions of if/while/do/for/?:) so that each evaluation records which conditions were evaluated, their values and the outcome (Tarp/McDc/DecisionRewriter.cs), and checks that the result still compiles: a decision whose instrumentation would break the build is left alone and reported (Tarp/McDc/McDcBuildInstrumenter.cs).
  2. The rewritten sources (in obj/.../tarp/) and the runtime (Tarp/GenerationTemplates/McDcRuntime.cs) replace the project's sources for the compiler only. #line directives keep errors, stack traces and the debugger on the original files. A normal build afterwards compiles the original sources again.
  3. The instrumented code writes the distinct evaluations to TestResults/tarp/*.hits when the test host exits, next to each project's map (<assembly>.<target framework>.map.json).
  4. The report replays the evaluations through the monitor algorithm (McDcFunctions) and lists, per decision, the evaluations seen, the conditions shown, and a test for every missing value. dotnet tarp mcdc-report prints it again from TestResults/tarp.

Options: --tarp-results <dir> (instead of TestResults/tarp), --tarp-report <file> (instead of the console). In a project: <TarpExclude>true</TarpExclude> to leave it out; [ExcludeFromCodeCoverage] leaves out a member or type.

A single project, without a build

dotnet tarp mcdc-instrument -p MyProject.csproj -o Instrumented writes an instrumented copy of the project; build and run it, then dotnet tarp mcdc-report -d Instrumented. The copy only builds for SDK-style projects whose sources are under the project directory, without project references.

Not instrumented

Listed in the report with the reason: decisions in expression-tree lambdas or query expressions, constant ones, ones with a condition that isn't a bool (e.g. dynamic) or with more than 16 conditions, ones in projects older than C# 7.3, and ones whose instrumentation breaks compilation. Pattern variables (o is string s && s.Length > 0), assignments in conditions and await are fine: each condition gets markers that keep what the compiler knows after it (see DecisionRewriter), and the evaluation in progress is a local, so it survives an await. Files that are generated (in obj/, *.g.cs, *.designer.cs, or marked <auto-generated>) aren't instrumented.

Building and releasing

CI (.github/workflows/ci.yml) builds and tests on Linux and Windows, and runs samples/e2e.sh: it packs the tool, installs it into a copy of samples/Shop, runs dotnet tarp test, and checks the report.

To release, push a tag: git tag v0.1.0 && git push origin v0.1.0. The release workflow (.github/workflows/release.yml) takes the version from the tag, tests, packs, checks the package with samples/e2e.sh, and creates a GitHub release with the package. If the repository has a NUGET_API_KEY secret, it also publishes the package to nuget.org.

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 was computed.  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
0.8.0 106 11/19/2026
0.7.1 110 11/17/2026
0.7.0 666 11/2/2026
0.6.1 258 11/2/2026
0.6.0 98 11/2/2026
0.5.0 105 11/2/2026
0.4.0 106 11/2/2026
0.3.0 95 11/2/2026
0.2.0 108 11/2/2026
0.1.0 112 11/1/2026