Soenneker.Extensions.Task
11.0.144
Prefix Reserved
dotnet add package Soenneker.Extensions.Task --version 11.0.144
NuGet\Install-Package Soenneker.Extensions.Task -Version 11.0.144
<PackageReference Include="Soenneker.Extensions.Task" Version="11.0.144" />
<PackageVersion Include="Soenneker.Extensions.Task" Version="11.0.144" />
<PackageReference Include="Soenneker.Extensions.Task" />
paket add Soenneker.Extensions.Task --version 11.0.144
#r "nuget: Soenneker.Extensions.Task, 11.0.144"
#:package Soenneker.Extensions.Task@11.0.144
#addin nuget:?package=Soenneker.Extensions.Task&version=11.0.144
#tool nuget:?package=Soenneker.Extensions.Task&version=11.0.144
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.144 | 4,208 | 11/18/2026 |
| 11.0.143 | 95,027 | 11/11/2026 |
| 11.0.142 | 40,203 | 11/10/2026 |
| 11.0.141 | 200,049 | 10/26/2026 |
| 4.0.140 | 102,482 | 10/15/2026 |
| 4.0.139 | 20,340 | 10/14/2026 |
| 4.0.134 | 29,603 | 10/12/2026 |
| 4.0.133 | 16,113 | 10/12/2026 |
| 4.0.132 | 75,228 | 10/11/2026 |
| 4.0.131 | 221,941 | 9/24/2026 |
| 4.0.130 | 90,812 | 9/15/2026 |
| 4.0.129 | 112,100 | 9/12/2026 |
| 4.0.128 | 323,846 | 8/30/2026 |
| 4.0.127 | 38,465 | 8/29/2026 |
| 4.0.126 | 10,004 | 8/29/2026 |
| 4.0.125 | 421,642 | 7/27/2026 |
| 4.0.124 | 169,661 | 7/18/2026 |
| 4.0.123 | 298,301 | 6/18/2026 |
| 4.0.122 | 245,395 | 6/5/2026 |
| 4.0.121 | 310,907 | 4/22/2026 |
Configure .NET CI defaults and daily source scans