braid 0.7.0

dotnet add package braid --version 0.7.0
                    
NuGet\Install-Package braid -Version 0.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="braid" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="braid" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="braid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add braid --version 0.7.0
                    
#r "nuget: braid, 0.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package braid@0.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=braid&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=braid&version=0.7.0
                    
Install as a Cake Tool

braid

Deterministic concurrency testing for .NET libraries using explicit async probe points and replay tokens.

Find the interleaving. Copy the replay token. Keep the race fixed forever.

Tests fork logical workers, workers stop at named probes, and braid controls which worker is released next. When a race is understood, keep the reproducing interleaving as a copyable replay token.

Powered by NDepend

Install

dotnet add package braid

braid targets .NET 10.

Quick start

using Braid;

var workerCompleted = false;
var options = new RunOptions
{
    Iterations = 1,
    Schedule = ReplaySchedule.Replay(ReplayStep.Hit("worker-1", "ready")),
};

await Runner.RunAsync(
    async context =>
    {
        context.Fork(async () =>
        {
            await Probe.HitAsync("ready");
            workerCompleted = true;
        });

        await context.JoinAsync();
    },
    options);

Outside a braid run, Probe.HitAsync completes immediately. Inside a braid run, it becomes an explicit scheduling point.

Don't know the failing interleaving yet? Try bounded exploration:

await Runner.ExploreAsync(
    options => options
        .WithSeed(123)
        .WithMaxSchedules(1_000)
        .WithMaxStepsPerSchedule(100),
    async braid =>
    {
        await braid.WorkerAsync("reader", ReaderAsync);
        await braid.WorkerAsync("writer", WriterAsync);

        await braid.JoinAsync(cancellationToken);
        Assert.Equal(expected, observed);
    },
    cancellationToken);

When a run fails, use RunException.TryGetReplayText to export a replay token for a stable regression test.

Replay schedules

A replay schedule describes the exact worker/probe order to reproduce.

var options = new RunOptions
{
    Iterations = 1,
    Schedule = ReplaySchedule.Replay(
        ReplayStep.Hit("worker-1", "after-read"),
        ReplayStep.Hit("worker-2", "after-read"),
        ReplayStep.Hit("worker-1", "before-write"),
        ReplayStep.Hit("worker-2", "before-write")),
};

Schedules can also be parsed from text: ReplaySchedule.Parse("hit worker-1 after-read\nhit worker-2 after-read"). The parsed text is the same format braid emits as a replay token on failure.

For stricter two-phase interleaving control, use ReplayStep.Arrive / ReplayStep.Release instead of ReplayStep.Hit.

When to use braid

  • cache, CAS, TTL, and state-machine library tests;
  • race reproduction after a flaky failure is understood;
  • regression tests where a specific interleaving should stay fixed;
  • small async scenarios where explicit probes are acceptable.

Braid is not a TaskScheduler replacement, does not rewrite binaries, and is not a distributed-system test framework.

Learn more

SAST Tools

PVS-Studio - static code analyzer for Enterprise (C, C++, C#, Go, and Java) and Web (JS and TS) development.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 0 9/3/2026
0.6.0 120 7/10/2026
0.5.0 131 6/3/2026
0.4.0 119 5/22/2026
0.3.1 116 5/10/2026
0.3.0 113 5/9/2026
0.2.1 129 5/9/2026
0.2.0 118 5/8/2026
0.1.0 130 5/8/2026
0.1.0-preview.1 67 5/7/2026