From fbf3b1d61d80490804764853856fc6bf4710cec9 Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:43:42 +0000 Subject: [PATCH] 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 <223556219+Copilot@users.noreply.github.com> --- src/FSharp.Control.AsyncSeq/AsyncSeq.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs index 0f826c2..3be0452 100644 --- a/src/FSharp.Control.AsyncSeq/AsyncSeq.fs +++ b/src/FSharp.Control.AsyncSeq/AsyncSeq.fs @@ -1906,7 +1906,9 @@ module AsyncSeq = use _ = { new IDisposable with member __.Dispose() = - e.DisposeAsync().AsTask() |> Async.AwaitTask |> Async.RunSynchronously } + // Fire-and-forget: avoids Async.RunSynchronously which deadlocks + // on single-threaded runtimes such as Blazor WASM (see issue #152). + e.DisposeAsync() |> ignore } let mutable currentResult = true while currentResult do