taskSeq stops after the first await (Task.Yield/Task.Delay between yields) when the consuming project is built in Debug; Release works (TaskSeq 1.1.1, .NET SDK 10.0.400) · Issue #473 · fsprojects/FSharp.Control.TaskSeq · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
taskSeq stops after the first await (Task.Yield/Task.Delay between yields) when the consuming project is built in Debug; Release works (TaskSeq 1.1.1, .NET SDK 10.0.400) #473
With FSharp.Control.TaskSeq 1.1.1, a taskSeq that awaits between yields (do! Task.Yield() or do! Task.Delay n) stops after the first await when the consuming project is compiled in the Debug configuration. The same code enumerates every item in Release. TaskSeq.toListAsync, a manual GetAsyncEnumerator / MoveNextAsync loop and an ASP.NET Core response writer consuming the IAsyncEnumerable are all affected. A taskSeq without awaits between yields is fine.
Impact: dotnet test builds Debug by default, so tests that stream through a taskSeq silently observe only the first item. That is how I ran into it (an xunit test of a chunked HTTP writer that takes an IAsyncEnumerable).
Also reproduces with .NET SDK 11.0.100-preview.6, net11.0, FSharp.Core 11.0.0.0 (file version 11.1.126.36018)
FSharp.Control.TaskSeq 1.1.1
What I could narrow down
The awaitBetweenYields result is deterministic (3 of 3 runs each: Debug [1], Release [1; 2; 3]). The for shape flips between [] and [1] across Debug runs, so a race looks likely.
It is not the runtime or the dependencies: bin/Debug and bin/Release contain byte-identical FSharp.Core.dll and FSharp.Control.TaskSeq.dll, the deps.json files are identical and the runtimeconfig.json files differ only by MetadataUpdater.IsSupported. Copying the Release-compiled Repro.dll into the Debug output folder works; copying the Debug-compiled Repro.dll into the Release output folder fails. So it depends on how the consuming assembly (the one containing the taskSeq { } block) is compiled.
The full fsc argument diff between the two configurations is only: Debug --define:DEBUG --optimize- --tailcalls- -g versus Release --define:RELEASE --optimize+.
Building Release with the Debug flag set (dotnet run -c Release -p:Optimize=false -p:Tailcalls=false -p:DebugSymbols=true -p:DebugType=portable -p:DefineConstants=DEBUG) reproduces the bug. Building Debug with the Release flag set (dotnet run -c Debug -p:Optimize=true -p:Tailcalls=true -p:DebugSymbols=false -p:DebugType=none -p:DefineConstants=RELEASE) makes it work.
Flipping a single flag was not enough for me: Debug with -p:Optimize=true -p:Tailcalls=true (still -g) fails, Release with -p:Optimize=false -p:Tailcalls=false (no -g) works, and Debug with -p:DebugSymbols=false -p:DebugType=none (still --optimize-) fails.
The failing binaries carry DebuggableAttribute(IsJITOptimizerDisabled = true); the working ones do not.
Update on upstream fix status: dotnet/fsharp#20469 (the fix for this Debug-mode state machine lowering regression) merged on 2026-09-14, but it has not yet shipped in a released .NET SDK.
I re-ran the regression scenario against the newest SDK currently available (10.0.401, built 2026-09-20) and confirmed the truncation bug still reproduces — this SDK predates the fix landing in a servicing build. I'll keep watching for the fix to appear in a shipped SDK and will follow up here (and update the README "Known issues" note / close this issue) once it does.
No action needed from maintainers right now; this remains an external compiler issue with the documented Release-build workaround still in effect.
Generated by 🌈 Repo Assist, see workflow run. Learn more. Comment /repo-assist to run again
Add this agentic workflow to your repo
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@4bc8419fad05e6b032741cbfd189986700bcf71c
Activity
github-actions commentedon Sep 11, 2026
docs: add Known Issues section for Debug-mode compiler bug affecting …
github-actions commentedon Sep 25, 2026
🤖 This is an automated response from Repo Assist.
Update on upstream fix status: dotnet/fsharp#20469 (the fix for this Debug-mode state machine lowering regression) merged on 2026-09-14, but it has not yet shipped in a released .NET SDK.
I re-ran the regression scenario against the newest SDK currently available (
10.0.401, built 2026-09-20) and confirmed the truncation bug still reproduces — this SDK predates the fix landing in a servicing build. I'll keep watching for the fix to appear in a shipped SDK and will follow up here (and update the README "Known issues" note / close this issue) once it does.No action needed from maintainers right now; this remains an external compiler issue with the documented Release-build workaround still in effect.
Add this agentic workflow to your repo
To install this agentic workflow, run
xperiandri commentedon Oct 17, 2026
What about 10.0.402?
xperiandri commentedon Oct 17, 2026
Checked: 10.0.402 does not contain the fix.
[1]in Debug and[1; 2; 3]in Release with SDK 10.0.402 and TaskSeq 1.1.1.fsc.dll15.2.402-servicing.26505.111) comes from dotnet/dotnet@a8dd057, whosesrc/source-manifest.jsonpins dotnet/fsharp@7587a55 (2026-09-23).release/10.0.4xx, [release/10.0.4xx] Preserve resumable state-machine lowering in Debug dotnet/fsharp#20692, was merged on 2026-10-14 as dotnet/fsharp@cf49d56, four commits later, so it should ship with the next 10.0.4xx SDK.