Caliburn.Light.Coroutines 7.1.0

dotnet add package Caliburn.Light.Coroutines --version 7.1.0
                    
NuGet\Install-Package Caliburn.Light.Coroutines -Version 7.1.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="Caliburn.Light.Coroutines" Version="7.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Caliburn.Light.Coroutines" Version="7.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Caliburn.Light.Coroutines" />
                    
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 Caliburn.Light.Coroutines --version 7.1.0
                    
#r "nuget: Caliburn.Light.Coroutines, 7.1.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 Caliburn.Light.Coroutines@7.1.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=Caliburn.Light.Coroutines&version=7.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Caliburn.Light.Coroutines&version=7.1.0
                    
Install as a Cake Tool

Caliburn.Light.Coroutines

NuGet

Coroutine support for Caliburn.Light - compose asynchronous workflows as sequential steps.

Overview

Caliburn.Light.Coroutines provides an ICoTask-based coroutine system that lets you compose asynchronous operations as sequential pipelines. Each step in a pipeline signals completion via an event, and the framework chains them together automatically.

  • ICoTask / ICoTask<TResult>: The core abstraction — an asynchronous unit of work that signals completion via the Completed event
  • Sequential Composition: Yield multiple ICoTask instances from an IEnumerator<ICoTask> to run them in sequence
  • Decorators: Chain cross-cutting behaviors onto any coroutine:
    • Rescue<TException> — catch and handle specific exceptions with a recovery coroutine (optional cancelCoTask parameter, default true, controls whether the overall coroutine is reported as cancelled after the rescue runs)
    • WhenCancelled — run an alternative coroutine when the original is canceled
    • OverrideCancel — suppress cancellation and continue normally
  • Adapters: Wrap existing constructs as coroutines with Coroutine.From():
    • Action and Func<TResult> delegates
    • Func<CommandExecutionContext, Task>, Func<CommandExecutionContext, Task<TResult>>, Func<Task>, and Func<Task<TResult>>
    • IEnumerator<ICoTask> sequences
  • SimpleCoTask: Factory for trivial coroutines — Succeeded(), Cancelled(), Failed(exception)
  • Task Integration: Convert any ICoTask to Task with ExecuteAsync() for use with async/await

Usage

// Wrap a delegate as a coroutine
ICoTask step = Coroutine.From(() => Console.WriteLine("Hello"));

// Compose a sequence from a generator method
ICoTask sequence = Coroutine.From(GetSteps());

IEnumerator<ICoTask> GetSteps()
{
    yield return Coroutine.From(() => LoadData());
    yield return Coroutine.From(LoadFromServerAsync);
    yield return Coroutine.From(() => UpdateUI());
}

// Execute with async/await
await sequence.ExecuteAsync();

// Add error handling and cancellation recovery
ICoTask robust = Coroutine.From(LoadFromServerAsync)
    .Rescue<HttpRequestException>(ex => Coroutine.From(() => ShowError(ex)))
    .WhenCancelled(() => Coroutine.From(() => ShowCancelledMessage()));

Note that Rescue (with the default cancelCoTask: true) and WhenCancelled keep the overall coroutine marked as cancelled even when the fallback succeeds — so await robust.ExecuteAsync() throws TaskCanceledException. Use .OverrideCancel(), or .OverrideCancel<TResult>(...) when a result is involved, to turn the cancelled outcome into a successful one instead.

Documentation

For complete documentation, visit the Caliburn.Light documentation.

License

Caliburn.Light is licensed under the MIT license.

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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Caliburn.Light.Coroutines:

Package Downloads
Caliburn.Light

The magic-free Caliburn.Light, a powerful framework designed for building XAML applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.1.0 101 10/9/2026