Repro steps
Provide the steps required to reproduce the problem:
open System
open System.Threading.Tasks
[<EntryPoint>]
let main _ =
let rec loop (x: int) = async {
do! Task.CompletedTask |> Async.AwaitTask
Console.WriteLine x
return! loop(x+1)
}
Async.RunSynchronously (loop 0)
0
with
<PackageReference Update="FSharp.Core" Version="5.0.2"/>
dotnet run -c Release (both Release and Debug are affected)
Expected behavior
It should work
Actual behavior
Stack Overflow!
Known workarounds
- You could downgrade to 5.0.0 (Implicit in net5 SDK) or to 5.0.1 to make it work again:
<PackageReference Update="FSharp.Core" Version="5.0.0"/>
- OR Change Completed task to fake async with real continuation
do! Task.CompletedTask |> Async.AwaitTask
to
do! Task.Delay 1 |> Async.AwaitTask
Related information
Call stack shows that all COMPLETED tasks continuations started its trampoline on a stack of previous trampoline which causes SO.
It actually crashed production system which was working on Pulsar.Client.Dotnet (it currently using 5.0.2)
I also tried to find related changes with GitHub help:
https://github.com/dotnet/fsharp/compare/5.0.0..5.0.2
But I couldn't find any related to FSharp.Core tags.
UPDATED: 5.0.1 also works ok. So regression was introduced between 5.0.1 and 5.0.2
UPDATED2: suspect PR
#11142
Repro steps
Provide the steps required to reproduce the problem:
with
dotnet run -c Release(both Release and Debug are affected)Expected behavior
It should work
Actual behavior
Stack Overflow!
Known workarounds
to
Related information
Call stack shows that all COMPLETED tasks continuations started its trampoline on a stack of previous trampoline which causes SO.
It actually crashed production system which was working on Pulsar.Client.Dotnet (it currently using 5.0.2)
I also tried to find related changes with GitHub help:
https://github.com/dotnet/fsharp/compare/5.0.0..5.0.2
But I couldn't find any related to FSharp.Core tags.
UPDATED: 5.0.1 also works ok. So regression was introduced between 5.0.1 and 5.0.2
UPDATED2: suspect PR
#11142