Robotico.Result 1.0.4

Robotico.Result

Woodpecker CI

Industry-standard Result and error types for .NET 8 and .NET 10. Railway-oriented, immutable, zero package dependencies (no NuGet dependencies when you install). Trim-friendly; no reflection on hot paths.

.NET 8 .NET 10 C# GitHub Packages Build

Features

  • Result types: Result (void), Result<TData>, Result<TData, TError> — all readonly struct
  • Industry naming: Map, Bind, MapError (no LINQ-style Select)
  • Pattern matching: Match(onSuccess, onError) for all three result types (void, Result<TData>, Result<TData, TError>)
  • Side effects: Tap, TapError, TapAsync, TapErrorAsync (void and both generic variants)
  • Recovery: Recover, RecoverWith, RecoverAsync; void and typed results have RecoverWith(fallback) (value or full result fallback)
  • Validation: Ensure(predicate, errorFactory) for Result<TData> and Result<TData, TError>
  • Aggregation: Collect, Sequence, ChooseSuccessful
  • Combining: Combine(r1, r2) … Combine(r1, r2, r3, r4) (tuples); Combine(results) for N results of same type → Result<ImmutableArray<T>>
  • Exception boundary: Try, TryAsync, ExpectSuccess, ResultErrorException<TError>
  • Errors: IError, Error, SimpleError, ValidationError, ExceptionError, DomainError<TCode>, AggregateError
  • ValidationError: Result.ValidationError(errors), ValidationError.ForField(name, message); use Result.Error<TData>(validationError) for a result
  • Explicit conversions: Result.FromVoid(r), Result.From(r), Result.FromWithIError(r) to convert between result types (no implicit operators; CA1000/CA2225 compliant)
  • Task extensions: MapAsync, BindAsync, MapErrorAsync, MatchAsync, TapAsync, TapErrorAsync, RecoverWithAsync, GetValueAsync, ExpectSuccessAsync

Installation

dotnet add package Robotico.Result

Quick start

using Robotico.Result;
using Robotico.Result.Errors;

// Success / error
Result<int> ok = Result.Success(42);
Result<int> err = Result.Error<int>(new SimpleError("Something went wrong"));

// Map / Bind
Result<string> mapped = ok.Map(x => x.ToString());
Result<int> bound = ok.Bind(x => ParseUserId(x));

// Match
string message = result.Match(
    v => $"Value: {v}",
    e => $"Error: {e.Message}");

// Recover
Result<int> safe = result.RecoverWith(0);

// Try (exception → Result)
Result<int> r = ResultUtilities.Try(() => int.Parse(input));
Result r2 = ResultUtilities.TryAsync(async () => await client.SendAsync());

Choosing a result type

  • Result — No success value (e.g. save, delete). Success or error only.
  • Result<TData> — Success carries a value; errors are IError. Use when callers don't need a specific error type.
  • Result<TData, TError> — Success + value and a strongly typed error (e.g. ValidationError, DomainError<TCode>). Use when callers switch on or handle specific error types.

See the design doc (docs/design.adoc) for full guidance.

Documentation

Detailed architecture and design docs (AsciiDoc + Mermaid) are in the docs/ folder:

  • Architecture (docs/architecture.adoc) — Type hierarchy, data flow, exception boundary (with Mermaid diagrams).
  • Design (docs/design.adoc) — Design principles, when to use which type, API naming.
  • Trim and AOT (docs/trim-aot.adoc) — Trim-friendly and AOT-compatible; no reflection on hot paths.

To build HTML from the AsciiDoc sources (e.g. with Asciidoctor):

asciidoctor docs/index.adoc -o docs/index.html
asciidoctor docs/architecture.adoc -o docs/architecture.html
asciidoctor docs/design.adoc -o docs/design.html
asciidoctor docs/trim-aot.adoc -o docs/trim-aot.html

Versioning

We follow Semantic Versioning. Version 1.0.0 is the first stable release. No breaking changes in minor/patch versions.

Building, testing, and benchmarks

From the repo root:

dotnet restore
dotnet build -c Release
dotnet test tests/Robotico.Result.Tests/Robotico.Result.Tests.csproj -c Release

With coverage (Coverlet):

dotnet test tests/Robotico.Result.Tests/Robotico.Result.Tests.csproj -c Release --collect:"XPlat Code Coverage"

Optional CI gate (fail if line coverage below threshold):

dotnet test tests/Robotico.Result.Tests/Robotico.Result.Tests.csproj -c Release --collect:"XPlat Code Coverage" /p:CollectCoverage=true /p:Threshold=90 /p:ThresholdType=line

Run benchmarks (BenchmarkDotNet):

dotnet run -c Release -p benchmarks/Robotico.Result.Benchmarks/Robotico.Result.Benchmarks.csproj -- --filter "*"

Or open robotico-results.slnx in your IDE and build from there.

License

See repository license file.

Showing the top 20 packages that depend on Robotico.Result.

Packages Downloads
MishimaWire
Shared Mishima suite foundation: IEEE CRC-32, AES-GCM seal, reactive/IO primitives, and SlabV2 cell wire types (MishimaWireType 1–46) for MishimaDb, MishimaDocs, and MishimaGraph. Geometry/NTS is optional via MishimaWire.Geometry.
95
MishimaWire.Geometry
Optional MishimaWire Geometry satellite: NetTopologySuite WKB factories/getters and SQL/MM curve densify for GIS hosts. Depends on MishimaWire Core (no NTS on Core).
87
MishimaDb
Embedded MishimaDb single-file store (MVP: memory-mapped read + self-describing layout).
75
MishimaGraph.Abstractions
MishimaGraph capability contracts and MGR_* error catalog (arch F7/F8/F10).
70
MishimaGraph.Format
MishimaGraph G1 region codecs, store builder, and wire DTOs (arch F7/F8/F9).
70
MishimaGraph.Model
MishimaGraph catalog/schema DTOs, identity types, and partition topology (arch F7).
70
MishimaGraph.Storage
MishimaGraph durable 2PC sidecars and prepare/coord request wire slice (arch F7).
70
MishimaGraph
Embedded graph database engine (LPG + RDF) — WAL/MVCC, indexes, vector/HNSW, FTS/geo, cluster Raft, native GraphRAG APIs.
69
MishimaGraph.Cluster
MishimaGraph Raft cluster runtime and distributed txn coordination slice (arch F7).
69
Mishima.Ann
Algorithm-only ANN kernels for Mishima (Exact/HNSW/IVF/PQ/DiskANN-class). Not a storage engine; not MishimaWire.
65
MishimaTime
Embedded native time-series engine for Mishima (no SQL/PromQL — languages on Nexus).
60
MishimaTime.Abstractions
MishimaTime capability contracts and MTM_* error catalog.
59
MishimaTime.Storage
MishimaTime WAL + time-ordered series storage kernel.
58
Robotico.Outbox
Transactional outbox for .NET. IOutbox (EnqueueAsync, CommitAsync returning Result). Depends on Robotico.Result.
34
Robotico.Graph
Application ports for labeled property graph stores: session/store, vertex and edge mutations, neighborhood and label paging. Engine adapters (e.g. Robotico.Graph.MishimaGraph) implement these ports. Not an IRepository.
31
Robotico.Resilience
Retry and circuit breaker for operations that return Result. Depends only on Robotico.Result. RetryPolicy, Retry.ExecuteAsync, CircuitBreaker.
30
Robotico.Mediator
Lightweight mediator pattern for .NET: CQRS-style request/handler dispatch with pipeline behaviors. Uses Robotico.Result for void/command results. Assembly-scan registration.
29
MishimaWire
Shared Mishima suite foundation: IEEE CRC-32, AES-GCM seal, reactive/IO primitives, and SlabV2 cell wire types (MishimaWireType 1–46) for MishimaDb, MishimaDocs, and MishimaGraph. Geometry/NTS is optional via MishimaWire.Geometry.
27
Robotico.Time
Application ports for embedded time-series + wide-event stores: session/store, metric series register/append/query, wide-event tables with inverted/full-text lookup, and a required Doctor ops report. Engine adapters (e.g. Robotico.Time.MishimaTime) implement these ports. Not an IRepository.
27
Robotico.Idempotency
Command idempotency for APIs and messaging. IIdempotencyStore, Result. Depends on Robotico.Result.
26

.NET 8.0

  • No dependencies.

.NET 10.0

  • No dependencies.

Version Downloads Last updated
1.0.4 131 07/26/2026
1.0.3 160 06/03/2026