Zero Production Footprint
Production assemblies never reference Faultline. Faultline.Rewriter instruments test
outputs at build time and transparently passes through outside a simulation.
Inspired by Rust's MadSim and FoundationDB. Run unmodified C# async/await
distributed systems inside a single-threaded, seed-driven discrete-event simulator with virtual time,
seeded task interleaving, and AsmResolver IL rewriting.
dotnet add package Faultline
Production assemblies never reference Faultline. Faultline.Rewriter instruments test
outputs at build time and transparently passes through outside a simulation.
DateTime.UtcNow, Stopwatch, TimeProvider, and
Task.Delay fast-forward instantaneously—run 30-minute timeout scenarios in microseconds.
Powered by a cross-platform Xoshiro256** PRNG and deterministic TaskScheduler.
Every failure prints a ulong seed that reproduces the exact interleaving.
Spin up multiple virtual hosts in one process with per-host clock offsets, independent PRNG forks,
AsyncLocal<SimHost> affinity, and Crash() / Restart().
When no ready continuations or pending timers remain while a scenario is incomplete,
SimDeadlockException fires immediately with the exact seed and virtual timestamp.
First-class TimeProvider integration, Guid.CreateVersion7() determinism,
strict analyzers, and zero third-party runtime dependencies in Faultline.
using Faultline;
var world = new SimWorld(new SimWorldOptions { Seed = 42 });
world.Run(async sim =>
{
sim.AddHost("node-a", async host =>
{
// Unmodified production code using DateTime.UtcNow, Task.Delay, Random.Shared, Task.Run
await UnmodifiedService.RunAsync(host.ShutdownToken);
}, clockOffset: TimeSpan.FromSeconds(4));
await sim.DelayAsync(TimeSpan.FromMinutes(15));
});