Soenneker.Extensions.Task
11.0.143
Prefix Reserved
dotnet add package Soenneker.Extensions.Task --version 11.0.143
NuGet\Install-Package Soenneker.Extensions.Task -Version 11.0.143
<PackageReference Include="Soenneker.Extensions.Task" Version="11.0.143" />
<PackageVersion Include="Soenneker.Extensions.Task" Version="11.0.143" />
<PackageReference Include="Soenneker.Extensions.Task" />
paket add Soenneker.Extensions.Task --version 11.0.143
#r "nuget: Soenneker.Extensions.Task, 11.0.143"
#:package Soenneker.Extensions.Task@11.0.143
#addin nuget:?package=Soenneker.Extensions.Task&version=11.0.143
#tool nuget:?package=Soenneker.Extensions.Task&version=11.0.143
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 | net11.0 is compatible. |
-
net11.0
- No dependencies.
NuGet packages (33)
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.MemoryStream
An easy modern MemoryStream utility |
|
|
Soenneker.Utils.BackgroundQueue
A high-performance background Task/ValueTask queue |
|
|
Serilog.Sinks.XUnit.Injectable
The injectable, xUnit test output sink for Serilog |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.143 | 0 | 11/11/2026 |
| 11.0.142 | 0 | 11/10/2026 |
| 11.0.141 | 166,109 | 10/26/2026 |
| 4.0.140 | 100,689 | 10/15/2026 |
| 4.0.139 | 20,277 | 10/14/2026 |
| 4.0.134 | 29,558 | 10/12/2026 |
| 4.0.133 | 16,047 | 10/12/2026 |
| 4.0.132 | 75,159 | 10/11/2026 |
| 4.0.131 | 221,394 | 9/24/2026 |
| 4.0.130 | 90,705 | 9/15/2026 |
| 4.0.129 | 112,063 | 9/12/2026 |
| 4.0.128 | 323,659 | 8/30/2026 |
| 4.0.127 | 38,456 | 8/29/2026 |
| 4.0.126 | 10,004 | 8/29/2026 |
| 4.0.125 | 421,102 | 7/27/2026 |
| 4.0.124 | 168,933 | 7/18/2026 |
| 4.0.123 | 296,287 | 6/18/2026 |
| 4.0.122 | 245,290 | 6/5/2026 |
| 4.0.121 | 310,460 | 4/22/2026 |
| 4.0.120 | 311,829 | 3/12/2026 |
Upgrade .NET 11 release candidates to stable