feat(Async): StartTaskImmediate - #1
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Microsoft.FSharp.Control.Async in FSharp.Core with Async.StartTaskImmediate, a helper that captures the ambient CancellationToken, passes it to a task/value-task factory, and awaits the result using the newer Async.Await semantics (notably exception unwrapping).
Changes:
- Add
Async.StartTaskImmediateoverloads forTask,Task<'T>, and (on NETSTANDARD2_1)ValueTask,ValueTask<'T>. - Add unit tests covering result flow, cancellation token flow, exception unwrapping, and cancellation behavior.
- Update FSharp.Core surface area baselines (netstandard2.1) and add a release-notes entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs | Adds coverage for StartTaskImmediate across Task/ValueTask scenarios. |
| tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl | Records new public API entries for netstandard2.1 release surface-area validation. |
| tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.debug.bsl | Records new public API entries for netstandard2.1 debug surface-area validation. |
| src/FSharp.Core/async.fsi | Declares the new StartTaskImmediate overloads with XML docs. |
| src/FSharp.Core/async.fs | Implements StartTaskImmediate via Async.CancellationToken + Async.Await. |
| docs/release-notes/.FSharp.Core/11.0.100.md | Notes the new API addition in release notes. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
430f0d8 to
e1a34f0Compare9a9977a to
8cd3e4eCompareee01fe6 to
6db3977Compare93badc9 to
50814f5Compare1ca22cf to
9becd19Compare52f8576 to
87675b1Compare| AwaitUnitTask true (task.AsTask()) | ||
| #endif | ||
| static member StartTaskImmediate(createTask: CancellationToken -> Task<'T>) : Async<'T> = |
There was a problem hiding this comment.
is startTask a better parameter name?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
2317986 to
c8eda9fCompare# Conflicts: # tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs
bartelink
commented
Aug 13, 2026
Closing; reposted as dotnet/fsharp PR 20258 |
Addresses the task start+await aspect of fsharp/fslang-suggestions#1284
See also fsharp/fslang-suggestions#1467