From 86fcbe34761a820be6e906370e26e342d5252c89 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 24 Aug 2017 15:53:08 +0100 Subject: [PATCH] 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 --- src/fsharp/FSharp.Core/control.fs | 5 ++--- .../src/FSharp.Editor/LanguageService/LanguageService.fs | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core/control.fs b/src/fsharp/FSharp.Core/control.fs index 28986c052..9283a134b 100644 --- a/src/fsharp/FSharp.Core/control.fs +++ b/src/fsharp/FSharp.Core/control.fs @@ -2084,9 +2084,8 @@ namespace Microsoft.FSharp.Control // If it isn't, then create it, and go back to the start to // check arrivals again. match pulse with - | null -> - if timeout >= 0 || cancellationSupported then - ensurePulse() |> ignore + | null when timeout >= 0 || cancellationSupported -> + ensurePulse() |> ignore return! processFirstArrival() | _ -> // Wait until we have been notified about a message. When that happens, rescan the arrivals diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 9468f8a6e..bed7c7c60 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -352,7 +352,9 @@ and while true do let! siteProvider = inbox.Receive() do! Async.SwitchToContext ctx - this.SetupProjectFile(siteProvider, this.Workspace, "SetupProjectsAfterSolutionOpen") } + this.SetupProjectFile(siteProvider, this.Workspace, "SetupProjectsAfterSolutionOpen") + do! Async.SwitchToThreadPool() + } use _ = Events.SolutionEvents.OnAfterOpenProject |> Observable.subscribe ( fun args -> match args.Hierarchy with -- GitLab