ViShap.Rewind.Core 1.0.0-beta.1

Prefix Reserved
This is a prerelease version of ViShap.Rewind.Core.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ViShap.Rewind.Core --version 1.0.0-beta.1
                    
NuGet\Install-Package ViShap.Rewind.Core -Version 1.0.0-beta.1
                    
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="ViShap.Rewind.Core" Version="1.0.0-beta.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ViShap.Rewind.Core" Version="1.0.0-beta.1" />
                    
Directory.Packages.props
<PackageReference Include="ViShap.Rewind.Core" />
                    
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 ViShap.Rewind.Core --version 1.0.0-beta.1
                    
#r "nuget: ViShap.Rewind.Core, 1.0.0-beta.1"
                    
#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 ViShap.Rewind.Core@1.0.0-beta.1
                    
#: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=ViShap.Rewind.Core&version=1.0.0-beta.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ViShap.Rewind.Core&version=1.0.0-beta.1&prerelease
                    
Install as a Cake Tool

ViShap.Rewind.Core

The engine of ViShap.Rewind. Most applications install the meta-package ViShap.Rewind, which brings this package and the source generator together.

A block of code becomes an atomic unit of in-memory state change: when it completes, its changes to tracked state stay; when it throws, they are undone and the exception reaches the caller.

using ViShap.Rewind;

var balance = new RewindCell<decimal>(100m);

try
{
    Rewind.Run(() =>
    {
        balance.Value -= 30m;
        throw new InvalidOperationException("Payment declined");
    });
}
catch (InvalidOperationException)
{
}

Console.WriteLine(balance.Value); // 100

Effects that leave the process are bound to the outcome of the scope:

using ViShap.Rewind;

var stock = new RewindCell<int>(5);

Rewind.Run(scope =>
{
    stock.Value -= 1;
    scope.AfterCommit(() => Console.WriteLine("Reserved"));          // runs only if the change is kept
    scope.Effect(@do: () => Console.WriteLine("Hold placed"),
                 undo: () => Console.WriteLine("Hold released"));    // undone if the change is not kept
});

Files written, copied or deleted with RewindFile change at once and are put back if the block fails.

An asynchronous block runs in Rewind.RunAsync, whose scope follows it through every await.

What the library tracks is state it can restore: RewindCell<T>, the collections RewindList<T>, RewindDictionary<TKey, TValue> and RewindSet<T>, and the members built on them. A plain field keeps whatever value the block left in it.

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 (2)

Showing the top 2 NuGet packages that depend on ViShap.Rewind.Core:

Package Downloads
ViShap.Rewind

Atomic in-memory state change for .NET: a block of code either keeps all its changes or none, with effects bound to commit and rollback. Brings ViShap.Rewind.Core and its source generator.

ViShap.Rewind.Testing

Test tools for code that uses ViShap.Rewind: proves that every failure point of an operation leaves tracked state as it was and runs no deferred effect. For test projects.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 128 11/17/2026
1.0.0-rc.3 79 11/14/2026
1.0.0-rc.2 91 11/14/2026
1.0.0-rc.1 71 11/12/2026
1.0.0-beta.1 66 11/12/2026
1.0.0-alpha.1 65 11/11/2026