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
<PackageReference Include="Caliburn.Light.Coroutines" Version="7.1.0" />
<PackageVersion Include="Caliburn.Light.Coroutines" Version="7.1.0" />
<PackageReference Include="Caliburn.Light.Coroutines" />
paket add Caliburn.Light.Coroutines --version 7.1.0
#r "nuget: Caliburn.Light.Coroutines, 7.1.0"
#:package Caliburn.Light.Coroutines@7.1.0
#addin nuget:?package=Caliburn.Light.Coroutines&version=7.1.0
#tool nuget:?package=Caliburn.Light.Coroutines&version=7.1.0
Caliburn.Light.Coroutines
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 theCompletedevent- Sequential Composition: Yield multiple
ICoTaskinstances from anIEnumerator<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 (optionalcancelCoTaskparameter, defaulttrue, controls whether the overall coroutine is reported as cancelled after the rescue runs)WhenCancelled— run an alternative coroutine when the original is canceledOverrideCancel— suppress cancellation and continue normally
- Adapters: Wrap existing constructs as coroutines with
Coroutine.From():ActionandFunc<TResult>delegatesFunc<CommandExecutionContext, Task>,Func<CommandExecutionContext, Task<TResult>>,Func<Task>, andFunc<Task<TResult>>IEnumerator<ICoTask>sequences
SimpleCoTask: Factory for trivial coroutines —Succeeded(),Cancelled(),Failed(exception)- Task Integration: Convert any
ICoTasktoTaskwithExecuteAsync()for use withasync/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 | 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
- Caliburn.Light.Core (>= 7.1.0)
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 |