Skip to content

Commit 86fcbe3

Browse files
authored
prevent endless async loop on Receive (#3498)
* prevent endless async loop on Receive * don't run update loop on ui thread forever * Update LanguageService.fs
1 parent 83ce885 commit 86fcbe3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/fsharp/FSharp.Core/control.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,9 +2084,8 @@ namespace Microsoft.FSharp.Control
20842084
// If it isn't, then create it, and go back to the start to
20852085
// check arrivals again.
20862086
match pulse with
2087-
| null ->
2088-
if timeout >= 0 || cancellationSupported then
2089-
ensurePulse() |> ignore
2087+
| null when timeout >= 0 || cancellationSupported ->
2088+
ensurePulse() |> ignore
20902089
return! processFirstArrival()
20912090
| _ ->
20922091
// Wait until we have been notified about a message. When that happens, rescan the arrivals

vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,9 @@ and
352352
while true do
353353
let! siteProvider = inbox.Receive()
354354
do! Async.SwitchToContext ctx
355-
this.SetupProjectFile(siteProvider, this.Workspace, "SetupProjectsAfterSolutionOpen") }
355+
this.SetupProjectFile(siteProvider, this.Workspace, "SetupProjectsAfterSolutionOpen")
356+
do! Async.SwitchToThreadPool()
357+
}
356358

357359
use _ = Events.SolutionEvents.OnAfterOpenProject |> Observable.subscribe ( fun args ->
358360
match args.Hierarchy with

0 commit comments

Comments
 (0)