Skip to content

Commit fbf3b1d

Browse files
Copilotgithub-actions[bot]
authored andcommitted
Fix ofAsyncEnum deadlock on single-threaded runtimes (e.g. Blazor WASM)
Replace Async.RunSynchronously in IDisposable.Dispose with fire-and-forget to avoid blocking the only available thread on platforms such as Blazor WASM. Closes #152 Co-authored-by: Copilot <[email protected]>
1 parent e6b2ae3 commit fbf3b1d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/FSharp.Control.AsyncSeq/AsyncSeq.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,9 @@ module AsyncSeq =
19061906
use _ =
19071907
{ new IDisposable with
19081908
member __.Dispose() =
1909-
e.DisposeAsync().AsTask() |> Async.AwaitTask |> Async.RunSynchronously }
1909+
// Fire-and-forget: avoids Async.RunSynchronously which deadlocks
1910+
// on single-threaded runtimes such as Blazor WASM (see issue #152).
1911+
e.DisposeAsync() |> ignore }
19101912

19111913
let mutable currentResult = true
19121914
while currentResult do

0 commit comments

Comments
 (0)