diff options
author | Marius Ungureanu <teromario@yahoo.com> | 2018-11-24 05:31:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-24 05:31:36 +0300 |
commit | 276c2bcdc505d249d48f953d6233a3b7a1f1229e (patch) | |
tree | 971fb3d6316276a8c11255f00289624962d6374b /main/external/fsharpbinding | |
parent | 96cdaf9e1fd92dca73e6a206278d959031f5efa1 (diff) |
[Core] Fix ProgressMonitor dispose synchronization (#6648)
* [Core] Fix ProgressMonitor dispose synchronization
This change aims to fix problems with users of ProgressMonitors knowing which synchronization context
to call dispose on, by handling it itself.
It does a sync wait on disposing
Fixes VSTS #612543 - [ProgressMonitors] Dispose is not called on the right sync context
* Remove ProgressMonitor hack from VCS code
* Remove UI thread marshalling in F#
* Adapt unit tests now that they work right
Diffstat (limited to 'main/external/fsharpbinding')
-rw-r--r-- | main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs index 827867f30b..295fb6b933 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs @@ -277,9 +277,6 @@ module Refactoring = |> List.map (fun p -> p.FileName.ToString() ) with _ -> [] - let disposeMonitor (monitor:SearchProgressMonitor) = - Runtime.RunInMainThread(fun() -> monitor.Dispose()) |> ignore - let findReferences (editor:TextEditor, ctx:DocumentContext, symbolUse:FSharpSymbolUse, lastIdent) = let monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true) async { @@ -296,7 +293,7 @@ module Refactoring = for (filename, startOffset, endOffset) in distinctRefs do let sr = SearchResult (FileProvider (filename), startOffset, endOffset-startOffset) monitor.ReportResult sr - } |> Async.StartInThreadpoolWithContinuation(fun () -> disposeMonitor monitor) + } |> Async.StartInThreadpoolWithContinuation(fun () -> monitor.Dispose ()) let findDerivedReferences (editor:TextEditor, ctx:DocumentContext, symbolUse:FSharpSymbolUse, lastIdent) = let monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true) @@ -314,7 +311,7 @@ module Refactoring = for (filename, startOffset, endOffset) in distinctRefs do let sr = SearchResult (FileProvider (filename), startOffset, endOffset-startOffset) monitor.ReportResult sr - } |> Async.StartInThreadpoolWithContinuation(fun () -> disposeMonitor monitor) + } |> Async.StartInThreadpoolWithContinuation(fun () -> monitor.Dispose ()) let findOverloads (editor:TextEditor, _ctx:DocumentContext, symbolUse:FSharpSymbolUse, _lastIdent) = let monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true) @@ -338,7 +335,7 @@ module Refactoring = for (filename, startOffset, endOffset) in distinctRefs do let sr = SearchResult (FileProvider (filename), startOffset, endOffset-startOffset) monitor.ReportResult sr - } |> Async.StartInThreadpoolWithContinuation(fun () -> disposeMonitor monitor) + } |> Async.StartInThreadpoolWithContinuation(fun () -> monitor.Dispose ()) let findExtensionMethods (editor:TextEditor, ctx:DocumentContext, symbolUse:FSharpSymbolUse, lastIdent) = let monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true) @@ -356,7 +353,7 @@ module Refactoring = for (filename, startOffset, endOffset) in distinctRefs do let sr = SearchResult (FileProvider (filename), startOffset, endOffset-startOffset) monitor.ReportResult sr - } |> Async.StartInThreadpoolWithContinuation(fun () -> disposeMonitor monitor) + } |> Async.StartInThreadpoolWithContinuation(fun () -> monitor.Dispose ()) module Operations = let canRename (symbolUse:FSharpSymbolUse) fileName project = |