ViShap.Rewind.Core
1.0.0-rc.1
Prefix Reserved
See the version list below for details.
dotnet add package ViShap.Rewind.Core --version 1.0.0-rc.1
NuGet\Install-Package ViShap.Rewind.Core -Version 1.0.0-rc.1
<PackageReference Include="ViShap.Rewind.Core" Version="1.0.0-rc.1" />
<PackageVersion Include="ViShap.Rewind.Core" Version="1.0.0-rc.1" />
<PackageReference Include="ViShap.Rewind.Core" />
paket add ViShap.Rewind.Core --version 1.0.0-rc.1
#r "nuget: ViShap.Rewind.Core, 1.0.0-rc.1"
#:package ViShap.Rewind.Core@1.0.0-rc.1
#addin nuget:?package=ViShap.Rewind.Core&version=1.0.0-rc.1&prerelease
#tool nuget:?package=ViShap.Rewind.Core&version=1.0.0-rc.1&prerelease
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.
Besides scopes and cells, Core holds the tracked collections, change sets and undo/redo history, PropertyChanged
raised after the commit, participation in an ambient System.Transactions transaction, RewindFile, asynchronous
scopes, and metrics and traces under RewindDiagnostics.
Rewind restores state on the thread that changed it; it does not isolate threads from each other, and it joins only an
ambient System.Transactions transaction. The documentation starts with
getting started.
| Product | Versions 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. |
-
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 |