Repository navigation
Releases
Releases · gokhanertogan/StructuredConcurrency
v0.11.2: Task.WhenAll Cancellation Check
First release of the Task.WhenAll Cancellation Check action on GitHub Marketplace.
It flags Task.WhenAll calls in C# that keep the other operations running after one fails, as annotations on the pull request and a table in the job summary. It works on any C# repository, with no package reference and no change to your projects.
- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- uses: gokhanertogan/StructuredConcurrency@v0.11.2Inputs: project, fail-on-findings (default false, report only), build-arguments, analyzer-version. Output: findings. See the README for details.
Changes in 0.11.2
- The action's description now fits Marketplace's 125-character limit. No change to the NuGet packages or to what the action does.
- A workflow runs the action from each released tag with its defaults on Windows, Linux and macOS.
Use @v0.11.2 or later: @v0.11.0 can't load the analyzers on a fresh runner (fixed in 0.11.1).
v0.11.1
Fixes
- GitHub Action: the action failed with
CS8034: Unable to load Analyzer assemblyon a fresh runner, because it
saved the downloaded analyzers under a file name with the version in it, and the compiler loads an analyzer by its
file name. Use@v0.11.1;@v0.11.0doesn't work. The action also builds without the shared compiler server now, so
an earlier build in the same job can't hand it another version of the analyzers.
v0.11.0
New
- Analyzers:
SC0004(Task.WhenAllthat doesn't cancel the rest on failure) can check a project without the
package, when a.globalconfigsetsstructured_concurrency.analyze_without_package = true. Its code fix isn't
offered there. Projects that use the package see no change. - GitHub Action: this repository is now the Task.WhenAll Cancellation Check action
(uses: gokhanertogan/StructuredConcurrency@v0.11.0). It builds any C# repository with the analyzers added from
outside and reportsSC0004, plusSC0001-SC0003whereTaskGroupis used, as pull request annotations, a job
summary and afindingsoutput.
Other
- Releases are also published to GitHub Packages.
v0.10.0
Breaking changes
TaskGroup.AnyAsyncis nowTaskGroup.FirstSuccessAsync, with the same overloads and behavior. The old name looked
too much likeTask.WhenAny, which returns the first task to complete, even a failed one. There is no alias, so
rename the calls.RestartEvent.Restartis nowRestartEvent.RestartNumber. There is no alias, so rename the uses.
New
- Group timeouts:
TaskGroupOptions.Timeoutcancels the whole group when it runs too long and throws a
TimeoutException;TaskGroupOptions.TimeProvidermakes it testable withFakeTimeProvider. - Quorums:
TaskGroup.QuorumAsyncreturns the first N successes and cancels the rest, for replica reads and
majority votes. - Groups without a lambda:
TaskGroup.CreatewithJoinAsyncandawait using, like Java's
StructuredTaskScope. Leaving the block without joining cancels the children and waits for them. It works where a
lambda doesn't, such as an async iterator. - Pipelines:
SelectConcurrentAsynctakes anonFailurecallback that skips and reports a failed item instead of
ending the stream, andBufferAsynclets a stage read ahead of the one after it. - Why a child was cancelled:
group.CancellationReason(Failure,Timeout,Requested,CallerToken,
Disposed), like Go'scontext.Cause. It is set before the token is cancelled, so a child can read it in its
catch. - Load shedding:
group.TryRun(work, out task)starts a child only if a concurrency slot and a rate-limiter
permit are free right now, like Go'serrgroup.TryGo; otherwise it returnsfalseand queues nothing. - Docs: per-item timeouts in a pipeline (Elixir's
Task.async_streamtimeout:) and cleanup that must run after
cancellation (Kotlin'sNonCancellable, Trio's shield), both built fromWithTimeoutAsync. - Analyzers:
SC0002now also checks the body ofTaskGroup.RunAsyncand flags an outer token used where
group.CancellationTokenbelongs, with a code fix. A new suppressor (SCSP0001) silencesCS4014on
group.Run(...), whose task the group already awaits.
Fixes
SingleFlight: when every caller of a flight gave up, a new caller for the same key could start a second operation
while the cancelled one was still running. The new caller now waits for the old operation to stop first.default(TaskOutcome<T>).ToString()no longer throws.- Tracing:
taskgroup.cancelled_byis now documented with all its values, includingtimeoutanddisposed.
Other
- Samples: an ASP.NET Core minimal API (
samples/WebApi) and a queue worker (samples/Worker). - The public API is tracked with
PublicApiAnalyzers; stress tests and Stryker.NET mutation testing were added. CONTRIBUTING.md,SECURITY.md, and issue and pull request templates.