Soenneker.Extensions.Task
4.0.128
Prefix Reserved
dotnet add package Soenneker.Extensions.Task --version 4.0.128
NuGet\Install-Package Soenneker.Extensions.Task -Version 4.0.128
<PackageReference Include="Soenneker.Extensions.Task" Version="4.0.128" />
<PackageVersion Include="Soenneker.Extensions.Task" Version="4.0.128" />
<PackageReference Include="Soenneker.Extensions.Task" />
paket add Soenneker.Extensions.Task --version 4.0.128
#r "nuget: Soenneker.Extensions.Task, 4.0.128"
#:package Soenneker.Extensions.Task@4.0.128
#addin nuget:?package=Soenneker.Extensions.Task&version=4.0.128
#tool nuget:?package=Soenneker.Extensions.Task&version=4.0.128
Soenneker.Extensions.Task
Focused helpers for ConfigureAwait(false), Task/ValueTask adaptation, synchronous bridges, and observed fire-and-forget work.
Installation
dotnet add package Soenneker.Extensions.Task
Avoid context capture
using Soenneker.Extensions.Task;
HttpResponseMessage response = await httpClient.GetAsync(uri).NoSync();
NoSync() is shorthand for ConfigureAwait(false) for both Task and Task<T>. It prevents the await from requesting the current synchronization context; it does not guarantee that the continuation runs on a different thread.
Adapt a Task to ValueTask
ValueTask operation = task.ToValueTask();
ValueTask<int> valueOperation = valueTaskSource.ToValueTask();
The completed-success fast path avoids wrapping the original task. Faults and cancellation are preserved. Use this at API boundaries only; converting an existing Task does not recover an allocation that already occurred, and a ValueTask should normally be awaited only once.
Synchronous bridges
Result result = GetResultAsync().AwaitSync();
AwaitSync() blocks the calling thread and unwraps the original exception through GetAwaiter().GetResult(). AwaitSyncSafe() moves the wrapper await to TaskScheduler.Default, but it still blocks and cannot rescue a task whose completion itself requires the blocked UI or request context. Prefer async all the way.
The cancellation token on AwaitSyncSafe() controls scheduling of its wrapper; it does not cancel the supplied task. If the task is already complete, its result, exception, or cancellation wins directly.
Observe detached work
SaveAuditAsync().FireAndForgetSafe(exception => logger.LogError(exception, "Audit save failed"));
FireAndForgetSafe() observes task faults and optionally invokes a synchronous callback with the base exception. Callback failures are swallowed so the detached continuation cannot create another unobserved fault. This does not keep a process alive, retry failed work, propagate cancellation, or provide delivery guarantees; use a durable background queue for important work.
| 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 (48)
Showing the top 5 NuGet packages that depend on Soenneker.Extensions.Task:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.Stream
A collection of helpful Stream extension methods |
|
|
Soenneker.Extensions.Enumerable
A collection of helpful enumerable extension methods |
|
|
Soenneker.Utils.BackgroundQueue
A high-performance background Task/ValueTask queue |
|
|
Serilog.Sinks.XUnit.Injectable
The injectable, xUnit test output sink for Serilog |
|
|
Soenneker.Asyncs.Locks
The fastest .NET async lock. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.128 | 38,445 | 8/30/2026 |
| 4.0.127 | 29,059 | 8/29/2026 |
| 4.0.126 | 8,612 | 8/29/2026 |
| 4.0.125 | 393,781 | 7/27/2026 |
| 4.0.124 | 163,420 | 7/18/2026 |
| 4.0.123 | 288,637 | 6/18/2026 |
| 4.0.122 | 244,135 | 6/5/2026 |
| 4.0.121 | 306,641 | 4/22/2026 |
| 4.0.120 | 288,165 | 3/12/2026 |
| 4.0.119 | 2,152 | 3/12/2026 |
| 4.0.118 | 1,807 | 3/12/2026 |
| 4.0.117 | 9,695 | 3/12/2026 |
| 4.0.116 | 93,487 | 3/10/2026 |
| 4.0.115 | 58,633 | 3/9/2026 |
| 4.0.114 | 3,976 | 3/9/2026 |
| 4.0.113 | 1,645 | 3/9/2026 |
| 4.0.112 | 115,815 | 3/4/2026 |
| 4.0.111 | 404,182 | 1/6/2026 |
| 4.0.110 | 51,987 | 1/2/2026 |
| 4.0.109 | 47,499 | 12/31/2025 |
Clarify task semantics and contain callback faults