From 1aad363a8c8798b3162ec609842a542e7c6134fe Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:06:20 +0100 Subject: [PATCH 01/43] squash --- src/Compiler/Checking/CheckDeclarations.fs | 81 +-- src/Compiler/Checking/CheckDeclarations.fsi | 4 +- src/Compiler/Driver/CompilerConfig.fs | 2 +- src/Compiler/Driver/CompilerConfig.fsi | 2 +- src/Compiler/Driver/CompilerImports.fs | 22 +- src/Compiler/Driver/CompilerImports.fsi | 6 +- .../Driver/GraphChecking/GraphProcessing.fs | 233 ++----- .../Driver/GraphChecking/GraphProcessing.fsi | 6 +- src/Compiler/Driver/ParseAndCheckInputs.fs | 18 +- src/Compiler/Driver/ParseAndCheckInputs.fsi | 6 +- src/Compiler/Driver/fsc.fs | 4 +- src/Compiler/FSharp.Compiler.Service.fsproj | 1 + src/Compiler/Facilities/AsyncMemoize.fs | 39 +- src/Compiler/Facilities/AsyncMemoize.fsi | 6 +- src/Compiler/Facilities/BuildGraph.fs | 32 +- src/Compiler/Facilities/BuildGraph.fsi | 6 +- src/Compiler/Facilities/DiagnosticsLogger.fs | 26 +- src/Compiler/Facilities/DiagnosticsLogger.fsi | 8 +- src/Compiler/Interactive/fsi.fs | 4 +- src/Compiler/Service/BackgroundCompiler.fs | 161 +++-- src/Compiler/Service/BackgroundCompiler.fsi | 44 +- src/Compiler/Service/FSharpCheckerResults.fs | 16 +- src/Compiler/Service/FSharpCheckerResults.fsi | 6 +- src/Compiler/Service/FSharpProjectSnapshot.fs | 14 +- src/Compiler/Service/FSharpSource.fs | 14 +- src/Compiler/Service/FSharpSource.fsi | 3 +- src/Compiler/Service/IncrementalBuild.fs | 101 +-- src/Compiler/Service/IncrementalBuild.fsi | 3 +- src/Compiler/Service/ServiceAnalysis.fs | 17 +- src/Compiler/Service/TransparentCompiler.fs | 164 +++-- src/Compiler/Service/TransparentCompiler.fsi | 9 +- src/Compiler/Service/service.fs | 34 +- src/Compiler/Utilities/Async2.fs | 606 ++++++++++++++++++ src/Compiler/Utilities/Cancellable.fs | 224 +------ src/Compiler/Utilities/Cancellable.fsi | 74 --- .../CompilerService/AsyncMemoize.fs | 67 +- .../FSharp.Compiler.ComponentTests.fsproj | 12 +- .../BuildGraphTests.fs | 134 ++-- ...iler.Service.SurfaceArea.netstandard20.bsl | 182 +++++- .../ModuleReaderCancellationTests.fs | 7 +- ..._FSharp.Compiler.Service_Debug_net10.0.bsl | 3 + ....Compiler.Service_Debug_netstandard2.0.bsl | 5 +- ...Sharp.Compiler.Service_Release_net10.0.bsl | 9 +- ...ompiler.Service_Release_netstandard2.0.bsl | 11 +- .../LanguageService/WorkspaceExtensions.fs | 4 +- 45 files changed, 1377 insertions(+), 1053 deletions(-) create mode 100644 src/Compiler/Utilities/Async2.fs diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 6ed83af8136..493c2d01b3a 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -4859,9 +4859,9 @@ module TcDeclarations = //------------------------------------------------------------------------- // Bind module types //------------------------------------------------------------------------- - -let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcEnv) synSigDecl: Cancellable = - cancellable { +#nowarn 3511 +let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcEnv) synSigDecl: Async2 = + async2 { let g = cenv.g try match synSigDecl with @@ -5010,14 +5010,14 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE return env - with RecoverableException exn -> + with exn -> errorRecovery exn endm return env } and TcSignatureElements cenv parent endm env xml mutRecNSInfo defs = - cancellable { + async2 { // Ensure the .Deref call in UpdateAccModuleOrNamespaceType succeeds if cenv.compilingCanonicalFslibModuleType then let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs @@ -5033,10 +5033,16 @@ and TcSignatureElements cenv parent endm env xml mutRecNSInfo defs = } and TcSignatureElementsNonMutRec cenv parent typeNames endm env defs = - Cancellable.fold (TcSignatureElementNonMutRec cenv parent typeNames endm) env defs + async2 { + match defs with + | [] -> return env + | def :: rest -> + let! env = TcSignatureElementNonMutRec cenv parent typeNames endm env def + return! TcSignatureElementsNonMutRec cenv parent typeNames endm env rest + } and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (defs: SynModuleSigDecl list) = - cancellable { + async2 { let m = match defs with [] -> m | _ -> defs |> List.map (fun d -> d.Range) |> List.reduce unionRanges let scopem = (defs, m) ||> List.foldBack (fun h m -> unionRanges h.Range m) @@ -5091,7 +5097,7 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d and TcModuleOrNamespaceSignatureElementsNonMutRec cenv parent env (id, moduleKind, defs, m: range, xml) = - cancellable { + async2 { let endm = m.EndRange // use end of range for errors // Create the module type that will hold the results of type checking.... @@ -5249,7 +5255,7 @@ let TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial /// The non-mutually recursive case for a declaration let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem env synDecl = - cancellable { + async2 { let g = cenv.g cenv.synArgNameGenerator.Reset() let tpenv = emptyUnscopedTyparEnv @@ -5360,7 +5366,6 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem // Now typecheck. let! moduleContents, topAttrsNew, envAtEnd = TcModuleOrNamespaceElements cenv (Parent (mkLocalModuleRef moduleEntity)) endm envForModule xml None [] moduleDefs - |> cenv.stackGuard.GuardCancellable // Get the inferred type of the decls and record it in the modul. moduleEntity.entity_modul_type <- MaybeLazy.Strict moduleTyAcc.Value @@ -5452,7 +5457,6 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem let! moduleContents, topAttrs, envAtEnd = TcModuleOrNamespaceElements cenv parent endm envNS xml mutRecNSInfo [] defs - |> cenv.stackGuard.GuardCancellable MutRecBindingChecking.TcMutRecDefns_UpdateNSContents nsInfo let env, openDecls = @@ -5482,20 +5486,17 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem return (defns, [], topAttrs), env, envAtEnd - with RecoverableException exn -> + with exn -> errorRecovery exn synDecl.Range return ([], [], []), env, env } /// The non-mutually recursive case for a sequence of declarations -and [] TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm (defsSoFar, env, envAtEnd) (moreDefs: SynModuleDecl list) (ct: CancellationToken) = - - if ct.IsCancellationRequested then - ValueOrCancelled.Cancelled(OperationCanceledException ct) - else +and TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm (defsSoFar, env, envAtEnd) (moreDefs: SynModuleDecl list) = + async2 { match moreDefs with | [] -> - ValueOrCancelled.Value (List.rev defsSoFar, envAtEnd) + return List.rev defsSoFar, envAtEnd | firstDef :: otherDefs -> // Lookahead one to find out the scope of the next declaration. let scopem = @@ -5504,17 +5505,12 @@ and [] TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm else unionRanges (List.head otherDefs).Range endm - let result = Cancellable.run ct (TcModuleOrNamespaceElementNonMutRec cenv parent typeNames scopem env firstDef |> cenv.stackGuard.GuardCancellable) - - match result with - | ValueOrCancelled.Cancelled x -> - ValueOrCancelled.Cancelled x - | ValueOrCancelled.Value(firstDef, env, envAtEnd) -> - TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm ((firstDef :: defsSoFar), env, envAtEnd) otherDefs ct - + let! firstDef, env, envAtEnd = TcModuleOrNamespaceElementNonMutRec cenv parent typeNames scopem env firstDef + return! TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm ((firstDef :: defsSoFar), env, envAtEnd) otherDefs + } and TcModuleOrNamespaceElements cenv parent endm env xml mutRecNSInfo openDecls0 synModuleDecls = - cancellable { + async2 { // Ensure the deref_nlpath call in UpdateAccModuleOrNamespaceType succeeds if cenv.compilingCanonicalFslibModuleType then let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs @@ -5536,21 +5532,15 @@ and TcModuleOrNamespaceElements cenv parent endm env xml mutRecNSInfo openDecls0 return (moduleContents, topAttrsNew, envAtEnd) | None -> - let! ct = Cancellable.token () - let result = TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm ([], env, env) synModuleDecls ct - - match result with - | ValueOrCancelled.Value(compiledDefs, envAtEnd) -> - // Apply the functions for each declaration to build the overall expression-builder - let moduleDefs = List.collect p13 compiledDefs - let moduleDefs = match openDecls0 with [] -> moduleDefs | _ -> TMDefOpens openDecls0 :: moduleDefs - let moduleContents = TMDefs moduleDefs - - // Collect up the attributes that are global to the file - let topAttrsNew = List.collect p33 compiledDefs - return (moduleContents, topAttrsNew, envAtEnd) - | ValueOrCancelled.Cancelled x -> - return! Cancellable(fun _ -> ValueOrCancelled.Cancelled x) + let! compiledDefs, envAtEnd = TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm ([], env, env) synModuleDecls + // Apply the functions for each declaration to build the overall expression-builder + let moduleDefs = List.collect p13 compiledDefs + let moduleDefs = match openDecls0 with [] -> moduleDefs | _ -> TMDefOpens openDecls0 :: moduleDefs + let moduleContents = TMDefs moduleDefs + + // Collect up the attributes that are global to the file + let topAttrsNew = List.collect p33 compiledDefs + return (moduleContents, topAttrsNew, envAtEnd) } @@ -5762,7 +5752,7 @@ let CheckOneImplFile let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, _, implFileFrags, isLastCompiland, _, _)) = synImplFile let infoReader = InfoReader(g, amap) - cancellable { + async2 { use _ = Activity.start "CheckDeclarations.CheckOneImplFile" [| @@ -5787,7 +5777,6 @@ let CheckOneImplFile let defs = [ for x in implFileFrags -> SynModuleDecl.NamespaceFragment x ] let! moduleContents, topAttrs, envAtEnd = TcModuleOrNamespaceElements cenv ParentNone qualNameOfFile.Range envinner PreXmlDoc.Empty None openDecls0 defs - |> cenv.stackGuard.GuardCancellable let implFileTypePriorToSig = moduleTyAcc.Value @@ -5907,7 +5896,7 @@ let CheckOneImplFile /// Check an entire signature file let CheckOneSigFile (g, amap, thisCcu, checkForErrors, conditionalDefines, tcSink, isInternalTestSpanStackReferring, diagnosticOptions) tcEnv (sigFile: ParsedSigFileInput) = - cancellable { + async2 { use _ = Activity.start "CheckDeclarations.CheckOneSigFile" [| @@ -5938,7 +5927,7 @@ let CheckOneSigFile (g, amap, thisCcu, checkForErrors, conditionalDefines, tcSin try sigFileType |> IterTyconsOfModuleOrNamespaceType (fun tycon -> FinalTypeDefinitionChecksAtEndOfInferenceScope(cenv.infoReader, tcEnv.NameEnv, cenv.tcSink, false, tcEnv.DisplayEnv, tycon)) - with RecoverableException exn -> errorRecovery exn sigFile.QualifiedName.Range + with exn -> errorRecovery exn sigFile.QualifiedName.Range UpdatePrettyTyparNames.updateModuleOrNamespaceType sigFileType diff --git a/src/Compiler/Checking/CheckDeclarations.fsi b/src/Compiler/Checking/CheckDeclarations.fsi index 25a2af850b9..81dd63c2312 100644 --- a/src/Compiler/Checking/CheckDeclarations.fsi +++ b/src/Compiler/Checking/CheckDeclarations.fsi @@ -59,7 +59,7 @@ val CheckOneImplFile: ModuleOrNamespaceType option * ParsedImplFileInput * FSharpDiagnosticOptions -> - Cancellable + Async2 val CheckOneSigFile: TcGlobals * @@ -72,7 +72,7 @@ val CheckOneSigFile: FSharpDiagnosticOptions -> TcEnv -> ParsedSigFileInput -> - Cancellable + Async2 exception NotUpperCaseConstructor of range: range diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 5bd5c5266ce..b8a2ab62899 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -294,7 +294,7 @@ and IProjectReference = abstract FileName: string /// Evaluate raw contents of the assembly file generated by the project - abstract EvaluateRawContents: unit -> Async + abstract EvaluateRawContents: unit -> Async2 /// Get the logical timestamp that would be the timestamp of the assembly file generated by the project /// diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 646b4477be3..82cd78e36d7 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -88,7 +88,7 @@ and IProjectReference = /// Evaluate raw contents of the assembly file generated by the project. /// 'None' may be returned if an in-memory view of the contents is, for some reason, /// not available. In this case the on-disk view of the contents will be preferred. - abstract EvaluateRawContents: unit -> Async + abstract EvaluateRawContents: unit -> Async2 /// Get the logical timestamp that would be the timestamp of the assembly file generated by the project. /// diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index cb60295b4fe..8121afb6093 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -2248,7 +2248,7 @@ and [] TcImports // NOTE: When used in the Language Service this can cause the transitive checking of projects. Hence it must be cancellable. member tcImports.RegisterAndImportReferencedAssemblies(ctok, nms: AssemblyResolution list) = let tryGetAssemblyData (r: AssemblyResolution) = - async { + async2 { CheckDisposed() let m = r.originalReference.Range let fileName = r.resolvedPath @@ -2256,7 +2256,7 @@ and [] TcImports try let! contentsOpt = - async { + async2 { match r.ProjectReference with | Some ilb -> return! ilb.EvaluateRawContents() | None -> return ProjectAssemblyDataResult.Unavailable true @@ -2290,7 +2290,7 @@ and [] TcImports let phase2 () = [ tcImports.FindCcuInfo(ctok, m, ilShortAssemName, lookupOnly = true) ] - async { return phase2 () } + async2 { return phase2 () } else let dllinfo = { @@ -2320,9 +2320,9 @@ and [] TcImports else tcImports.PrepareToImportReferencedILAssembly(ctok, m, fileName, dllinfo) - async { return phase2 () } + async2 { return phase2 () } - async { + async2 { CheckDisposed() let tcConfig = tcConfigP.Get ctok @@ -2371,7 +2371,7 @@ and [] TcImports ReportWarnings warns tcImports.RegisterAndImportReferencedAssemblies(ctok, res) - |> Async.RunSynchronously + |> Async2.RunSynchronously |> ignore true @@ -2461,7 +2461,7 @@ and [] TcImports // we dispose TcImports is because we need to dispose type providers, and type providers are never included in the framework DLL set. // If a framework set ever includes type providers, you will not have to worry about explicitly calling Dispose as the Finalizer will handle it. static member BuildFrameworkTcImports(tcConfigP: TcConfigProvider, frameworkDLLs, nonFrameworkDLLs) = - async { + async2 { let ctok = CompilationThreadToken() let tcConfig = tcConfigP.Get ctok @@ -2538,7 +2538,7 @@ and [] TcImports resolvedAssemblies |> List.choose tryFindEquivPrimaryAssembly let! fslibCcu, fsharpCoreAssemblyScopeRef = - async { + async2 { if tcConfig.compilingFSharpCore then // When compiling FSharp.Core.dll, the fslibCcu reference to FSharp.Core.dll is a delayed ccu thunk fixed up during type checking return CcuThunk.CreateDelayed getFSharpCoreLibraryName, ILScopeRef.Local @@ -2629,7 +2629,7 @@ and [] TcImports (tcConfigP: TcConfigProvider, baseTcImports, nonFrameworkReferences, knownUnresolved, dependencyProvider) = - async { + async2 { let ctok = CompilationThreadToken() let tcConfig = tcConfigP.Get ctok @@ -2647,7 +2647,7 @@ and [] TcImports } static member BuildTcImports(tcConfigP: TcConfigProvider, dependencyProvider) = - async { + async2 { let ctok = CompilationThreadToken() let tcConfig = tcConfigP.Get ctok @@ -2679,7 +2679,7 @@ let RequireReferences (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, reso let ccuinfos = tcImports.RegisterAndImportReferencedAssemblies(ctok, resolutions) - |> Async.RunSynchronously + |> Async2.RunSynchronously let asms = ccuinfos diff --git a/src/Compiler/Driver/CompilerImports.fsi b/src/Compiler/Driver/CompilerImports.fsi index 9da0ef71b1d..d21bf2174bc 100644 --- a/src/Compiler/Driver/CompilerImports.fsi +++ b/src/Compiler/Driver/CompilerImports.fsi @@ -205,14 +205,14 @@ type TcImports = member internal Base: TcImports option static member BuildFrameworkTcImports: - TcConfigProvider * AssemblyResolution list * AssemblyResolution list -> Async + TcConfigProvider * AssemblyResolution list * AssemblyResolution list -> Async2 static member BuildNonFrameworkTcImports: TcConfigProvider * TcImports * AssemblyResolution list * UnresolvedAssemblyReference list * DependencyProvider -> - Async + Async2 static member BuildTcImports: - tcConfigP: TcConfigProvider * dependencyProvider: DependencyProvider -> Async + tcConfigP: TcConfigProvider * dependencyProvider: DependencyProvider -> Async2 /// Process a group of #r in F# Interactive. /// Adds the reference to the tcImports and add the ccu to the type checking environment. diff --git a/src/Compiler/Driver/GraphChecking/GraphProcessing.fs b/src/Compiler/Driver/GraphChecking/GraphProcessing.fs index 1854368285e..ee25786971a 100644 --- a/src/Compiler/Driver/GraphChecking/GraphProcessing.fs +++ b/src/Compiler/Driver/GraphChecking/GraphProcessing.fs @@ -4,6 +4,7 @@ open System.Threading open FSharp.Compiler.GraphChecking open System.Threading.Tasks open System +open Internal.Utilities.Library /// Information about the node in a graph, describing its relation with other nodes. type NodeInfo<'Item> = @@ -38,16 +39,13 @@ type ProcessedNode<'Item, 'Result> = type GraphProcessingException(msg, ex: Exception) = inherit exn(msg, ex) -let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> +let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> (graph: Graph<'Item>) - (work: ('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> 'Result) - (parentCt: CancellationToken) - : ('Item * 'Result)[] = + (work: ('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> Async2<'Result>) + : Async2<('Item * 'Result)[]> = + let transitiveDeps = graph |> Graph.transitive let dependents = graph |> Graph.reverse - // Cancellation source used to signal either an exception in one of the items or end of processing. - use localCts = new CancellationTokenSource() - use cts = CancellationTokenSource.CreateLinkedTokenSource(parentCt, localCts.Token) let makeNode (item: 'Item) : GraphNode<'Item, 'Result> = let info = @@ -91,203 +89,36 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> |> Option.defaultWith (fun () -> failwith $"Results for item '{node.Info.Item}' are not yet available") } - let processedCount = IncrementableInt(0) - - /// Create a setter and getter for an exception raised in one of the work items. - /// Only the first exception encountered is stored - this can cause non-deterministic errors if more than one item fails. - let raiseExn, getExn = - let mutable exn: ('Item * Exception) option = None - let lockObj = obj () - // Only set the exception if it hasn't been set already - let setExn newExn = - lock lockObj (fun () -> - match exn with - | Some _ -> () - | None -> exn <- newExn - - localCts.Cancel()) - - let getExn () = exn - setExn, getExn - - let incrementProcessedNodesCount () = - if processedCount.Increment() = nodes.Count then - localCts.Cancel() - let rec queueNode node = - Async.Start( - async { - let! res = async { processNode node } |> Async.Catch - - match res with - | Choice1Of2() -> () - | Choice2Of2 ex -> raiseExn (Some(node.Info.Item, ex)) - }, - cts.Token - ) - - and processNode (node: GraphNode<'Item, 'Result>) : unit = - - let info = node.Info - - let singleRes = work getItemPublicNode info - node.Result <- Some singleRes - - let unblockedDependents = - node.Info.Dependents - |> lookupMany - // For every dependent, increment its number of processed dependencies, - // and filter dependents which now have all dependencies processed (but didn't before). - |> Array.filter (fun dependent -> - let pdc = dependent.ProcessedDepsCount.Increment() - // Note: We cannot read 'dependent.ProcessedDepsCount' again to avoid returning the same item multiple times. - pdc = dependent.Info.Deps.Length) - - unblockedDependents |> Array.iter queueNode - incrementProcessedNodesCount () - - leaves |> Array.iter queueNode - - // Wait for end of processing, an exception, or an external cancellation request. - cts.Token.WaitHandle.WaitOne() |> ignore - // If we stopped early due to external cancellation, throw. - parentCt.ThrowIfCancellationRequested() - - // If we stopped early due to an exception, reraise it. - match getExn () with - | None -> () - | Some(item, ex) -> raise (GraphProcessingException($"Encountered exception when processing item '{item}'", ex)) - - // All calculations succeeded - extract the results and sort in input order. - nodes.Values - |> Seq.map (fun node -> - let result = - node.Result - |> Option.defaultWith (fun () -> failwith $"Unexpected lack of result for item '{node.Info.Item}'") - - node.Info.Item, result) - |> Seq.sortBy fst - |> Seq.toArray - -let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> - (graph: Graph<'Item>) - (work: ('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> Async<'Result>) - : Async<('Item * 'Result)[]> = - async { - let transitiveDeps = graph |> Graph.transitive - let dependents = graph |> Graph.reverse - // Cancellation source used to signal either an exception in one of the items or end of processing. - let! parentCt = Async.CancellationToken - use localCts = new CancellationTokenSource() - - let completionSignal = TaskCompletionSource() - - use _ = parentCt.Register(fun () -> completionSignal.TrySetCanceled() |> ignore) - - use cts = CancellationTokenSource.CreateLinkedTokenSource(parentCt, localCts.Token) - - let makeNode (item: 'Item) : GraphNode<'Item, 'Result> = - let info = - let exists = graph.ContainsKey item - - if - not exists - || not (transitiveDeps.ContainsKey item) - || not (dependents.ContainsKey item) - then - printfn $"Unexpected inconsistent state of the graph for item '{item}'" - - { - Item = item - Deps = graph[item] - TransitiveDeps = transitiveDeps[item] - Dependents = dependents[item] - } - - { - Info = info - Result = None - ProcessedDepsCount = IncrementableInt(0) - } - - let nodes = graph.Keys |> Seq.map (fun item -> item, makeNode item) |> readOnlyDict - - let lookupMany items = - items |> Array.map (fun item -> nodes[item]) - - let leaves = - nodes.Values |> Seq.filter (fun n -> n.Info.Deps.Length = 0) |> Seq.toArray - - let getItemPublicNode item = - let node = nodes[item] - - { - ProcessedNode.Info = node.Info - ProcessedNode.Result = - node.Result - |> Option.defaultWith (fun () -> failwith $"Results for item '{node.Info.Item}' are not yet available") - } - - let processedCount = IncrementableInt(0) - - let handleExn (item, ex: exn) = + async2 { try - localCts.Cancel() - with :? ObjectDisposedException -> - // If it's disposed already, it means that the processing has already finished, most likely due to cancellation or failure in another node. - () - - match ex with - | :? OperationCanceledException -> completionSignal.TrySetCanceled() - | _ -> - completionSignal.TrySetException( - GraphProcessingException($"[*] Encountered exception when processing item '{item}': {ex.Message}", ex) - ) - |> ignore - - let incrementProcessedNodesCount () = - if processedCount.Increment() = nodes.Count then - completionSignal.TrySetResult() |> ignore - - let rec queueNode node = - Async.Start( - async { - use! _catch = Async.OnCancel(completionSignal.TrySetCanceled >> ignore) - let! res = processNode node |> Async.Catch - - match res with - | Choice1Of2() -> () - | Choice2Of2 ex -> handleExn (node.Info.Item, ex) - }, - cts.Token - ) - - and processNode (node: GraphNode<'Item, 'Result>) : Async = - async { - - let info = node.Info + do! processNode node + with ex -> + return raise (GraphProcessingException($"Encountered exception when processing item '{node.Info.Item}'", ex)) + } - let! singleRes = work getItemPublicNode info - node.Result <- Some singleRes + and processNode (node: GraphNode<'Item, 'Result>) = + async2 { + let info = node.Info - let unblockedDependents = - node.Info.Dependents - |> lookupMany - // For every dependent, increment its number of processed dependencies, - // and filter dependents which now have all dependencies processed (but didn't before). - |> Array.filter (fun dependent -> - let pdc = dependent.ProcessedDepsCount.Increment() - // Note: We cannot read 'dependent.ProcessedDepsCount' again to avoid returning the same item multiple times. - pdc = dependent.Info.Deps.Length) + let! singleRes = work getItemPublicNode info + node.Result <- Some singleRes - unblockedDependents |> Array.iter queueNode - incrementProcessedNodesCount () - } + let unblockedDependents = + node.Info.Dependents + |> lookupMany + // For every dependent, increment its number of processed dependencies, + // and filter dependents which now have all dependencies processed (but didn't before). + |> Array.filter (fun dependent -> + let pdc = dependent.ProcessedDepsCount.Increment() + // Note: We cannot read 'dependent.ProcessedDepsCount' again to avoid returning the same item multiple times. + pdc = dependent.Info.Deps.Length) - leaves |> Array.iter queueNode + do! unblockedDependents |> Seq.map queueNode |> Async2.Parallel |> Async2.Ignore + } - // Wait for end of processing, an exception, or an external cancellation request. - do! completionSignal.Task |> Async.AwaitTask + async2 { + do! leaves |> Seq.map queueNode |> Async2.Parallel |> Async2.Ignore // All calculations succeeded - extract the results and sort in input order. return @@ -301,3 +132,11 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> |> Seq.sortBy fst |> Seq.toArray } + +let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> + (graph: Graph<'Item>) + (work: ('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> 'Result) + (parentCt: CancellationToken) + : ('Item * 'Result)[] = + let work node info = async2 { return work node info } + Async2.RunSynchronously(processGraphAsync graph (fun lookup info -> async2 { return! work lookup info }), parentCt) diff --git a/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi b/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi index 7a8c9f9885e..5e8d8bb46bf 100644 --- a/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi +++ b/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi @@ -3,6 +3,8 @@ module internal FSharp.Compiler.GraphChecking.GraphProcessing open System.Threading +open Internal.Utilities.Library + /// Information about the node in a graph, describing its relation with other nodes. type NodeInfo<'Item> = { Item: 'Item @@ -40,5 +42,5 @@ val processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> : val processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> : graph: Graph<'Item> -> - work: (('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> Async<'Result>) -> - Async<('Item * 'Result)[]> + work: (('Item -> ProcessedNode<'Item, 'Result>) -> NodeInfo<'Item> -> Async2<'Result>) -> + Async2<('Item * 'Result)[]> diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 769b31dd13b..05549c6ed16 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -1225,8 +1225,8 @@ let CheckOneInput tcSink: TcResultsSink, tcState: TcState, input: ParsedInput - ) : Cancellable = - cancellable { + ) : Async2 = + async2 { try use _ = Activity.start "ParseAndCheckInputs.CheckOneInput" [| Activity.Tags.fileName, input.FileName |] @@ -1344,7 +1344,7 @@ let DiagnosticsLoggerForInput (tcConfig: TcConfig, oldLogger) = /// Typecheck a single file (or interactive entry into F# Interactive) let CheckOneInputEntry (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt) tcState input = - cancellable { + async2 { // Equip loggers to locally filter w.r.t. scope pragmas in each input use _ = UseTransformedDiagnosticsLogger(fun oldLogger -> DiagnosticsLoggerForInput(tcConfig, oldLogger)) @@ -1355,7 +1355,7 @@ let CheckOneInputEntry (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcG return! CheckOneInput(checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, TcResultsSink.NoSink, tcState, input) } - |> Cancellable.runWithoutCancellation + |> Async2.runWithoutCancellation /// Finish checking multiple files (or one interactive entry into F# Interactive) let CheckMultipleInputsFinish (results, tcState: TcState) = @@ -1371,7 +1371,7 @@ let CheckMultipleInputsFinish (results, tcState: TcState) = (tcEnvAtEndOfLastFile, topAttrs, implFiles, ccuSigsForFiles), tcState let CheckOneInputAndFinish (checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input) = - cancellable { + async2 { let! result, tcState = CheckOneInput(checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input) let finishedResult = CheckMultipleInputsFinish([ result ], tcState) return finishedResult @@ -1445,8 +1445,8 @@ let CheckOneInputWithCallback _skipImplIfSigExists: bool): (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcResultsSink * TcState * ParsedInput * bool ) - : Cancellable> = - cancellable { + : Async2> = + async2 { try CheckSimulateException tcConfig @@ -1820,7 +1820,7 @@ let CheckMultipleInputsUsingGraphMode : Finisher = let (Finisher(finisher = finisher)) = - cancellable { + async2 { use _ = UseDiagnosticsLogger logger let checkForErrors2 () = @@ -1833,7 +1833,7 @@ let CheckMultipleInputsUsingGraphMode node (checkForErrors2, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, currentTcState, input, false) } - |> Cancellable.runWithoutCancellation + |> Async2.runWithoutCancellation Finisher( node, diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fsi b/src/Compiler/Driver/ParseAndCheckInputs.fsi index 3e47c3c17c6..f4d3d1ba1bf 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fsi +++ b/src/Compiler/Driver/ParseAndCheckInputs.fsi @@ -182,7 +182,7 @@ val CheckOneInput: tcSink: TcResultsSink * tcState: TcState * input: ParsedInput -> - Cancellable<(TcEnv * TopAttribs * CheckedImplFile option * ModuleOrNamespaceType) * TcState> + Async2<(TcEnv * TopAttribs * CheckedImplFile option * ModuleOrNamespaceType) * TcState> val CheckOneInputWithCallback: node: NodeToTypeCheck -> @@ -195,7 +195,7 @@ val CheckOneInputWithCallback: tcState: TcState * input: ParsedInput * _skipImplIfSigExists: bool -> - Cancellable> + Async2> val AddCheckResultsToTcState: tcGlobals: TcGlobals * @@ -250,4 +250,4 @@ val CheckOneInputAndFinish: tcSink: TcResultsSink * tcState: TcState * input: ParsedInput -> - Cancellable<(TcEnv * TopAttribs * CheckedImplFile list * ModuleOrNamespaceType list) * TcState> + Async2<(TcEnv * TopAttribs * CheckedImplFile list * ModuleOrNamespaceType list) * TcState> diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 198b74601c4..db5b6953aca 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -605,7 +605,7 @@ let main1 // Import basic assemblies let tcGlobals, frameworkTcImports = TcImports.BuildFrameworkTcImports(foundationalTcConfigP, sysRes, otherRes) - |> Async.RunImmediate + |> Async2.RunSynchronously let ilSourceDocs = [ @@ -653,7 +653,7 @@ let main1 let tcImports = TcImports.BuildNonFrameworkTcImports(tcConfigP, frameworkTcImports, otherRes, knownUnresolved, dependencyProvider) - |> Async.RunImmediate + |> Async2.RunSynchronously // register tcImports to be disposed in future disposables.Register tcImports diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index a249c5d2bb1..9448dbc6eb8 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -130,6 +130,7 @@ + diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs index 16f4787209d..0c0403cd5ef 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fs +++ b/src/Compiler/Facilities/AsyncMemoize.fs @@ -7,10 +7,12 @@ open System.Threading.Tasks open System.Runtime.CompilerServices open FSharp.Compiler.DiagnosticsLogger +open Internal.Utilities.Library +open System type AsyncLazyState<'t> = - | Initial of computation: Async<'t> - | Running of initialComputation: Async<'t> * work: Task<'t> * CancellationTokenSource * requestCount: int + | Initial of computation: Async2<'t> + | Running of initialComputation: Async2<'t> * work: Task<'t> * CancellationTokenSource * requestCount: int | Completed of result: 't | Faulted of exn @@ -48,16 +50,16 @@ type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool, | state -> state // Nothing more to do if state already transitioned. let detachable (work: Task<'t>) = - async { + async2 { try - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken // Using ContinueWith with a CancellationToken allows detaching from the running 'work' task. // If the current async workflow is canceled, the 'work' task will continue running independently. - do! work.ContinueWith(ignore>, ct) |> Async.AwaitTask + do! work.ContinueWith(ignore>, ct) with :? TaskCanceledException -> () // If we're here it means there was no cancellation and the 'work' task has completed. - return! work |> Async.AwaitTask + return! work } let onComplete (t: Task<'t>) = @@ -78,21 +80,21 @@ type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool, let cts = new CancellationTokenSource() let work = - Async + Async2 .StartAsTask(computation, cancellationToken = cts.Token) .ContinueWith(onComplete, TaskContinuationOptions.NotOnCanceled) Running(computation, work, cts, 1), detachable work | Running(c, work, cts, count) -> Running(c, work, cts, count + 1), detachable work - | Completed result as state -> state, async { return result } - | Faulted exn as state -> state, async { return raise exn } + | Completed result as state -> state, async2 { return result } + | Faulted exn as state -> state, async2 { return raise exn } // computation will deallocate after state transition to Completed ot Faulted. new(computation, ?cancelUnawaited: bool, ?cacheException) = AsyncLazy(Initial computation, defaultArg cancelUnawaited true, defaultArg cacheException true) member _.Request() = - async { + async2 { try return! withStateUpdate request finally @@ -175,7 +177,7 @@ type private KeyData<'TKey, 'TVersion> = Version: 'TVersion } -type Job<'t> = AsyncLazy * CapturingDiagnosticsLogger> +type internal Job<'t> = AsyncLazy * CapturingDiagnosticsLogger> [] type internal AsyncMemoize<'TKey, 'TVersion, 'TValue @@ -223,19 +225,19 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue } let wrappedComputation = - Async.TryCancelled( - async { + Async2.TryCancelled( + async2 { let sw = Stopwatch.StartNew() log Started key let logger = CapturingDiagnosticsLogger "cache" SetThreadDiagnosticsLoggerNoUnwind logger - match! computation |> Async.Catch with - | Choice1Of2 result -> + try + let! result = computation log Finished key Interlocked.Add(&duration, sw.ElapsedMilliseconds) |> ignore return Result.Ok result, logger - | Choice2Of2 exn -> + with exn -> log Failed key return Result.Error exn, logger }, @@ -260,7 +262,7 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue cached |> Option.map countHit |> Option.defaultWith cacheSetNewJob - async { + async2 { let otherVersions, job = lock cache getOrAdd log Requested key @@ -278,6 +280,9 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue | Error exn -> return raise exn } + member this.GetAsync(key, computation: Async<_>) = + this.Get(key, async2 { return! computation }) |> Async2.toAsync + member _.TryGet(key: 'TKey, predicate: 'TVersion -> bool) : 'TValue option = lock cache <| fun () -> diff --git a/src/Compiler/Facilities/AsyncMemoize.fsi b/src/Compiler/Facilities/AsyncMemoize.fsi index dd7b6c821da..4ac4b91b81f 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fsi +++ b/src/Compiler/Facilities/AsyncMemoize.fsi @@ -1,5 +1,7 @@ namespace Internal.Utilities.Collections +open Internal.Utilities.Library + [] module internal Utils = @@ -59,7 +61,9 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue member Clear: predicate: ('TKey -> bool) -> unit - member Get: key: ICacheKey<'TKey, 'TVersion> * computation: Async<'TValue> -> Async<'TValue> + member Get: key: ICacheKey<'TKey, 'TVersion> * computation: Async2<'TValue> -> Async2<'TValue> + + member GetAsync: key: ICacheKey<'TKey, 'TVersion> * computation: Async<'TValue> -> Async<'TValue> member TryGet: key: 'TKey * predicate: ('TVersion -> bool) -> 'TValue option diff --git a/src/Compiler/Facilities/BuildGraph.fs b/src/Compiler/Facilities/BuildGraph.fs index db77f52ea10..8a635a04647 100644 --- a/src/Compiler/Facilities/BuildGraph.fs +++ b/src/Compiler/Facilities/BuildGraph.fs @@ -5,6 +5,8 @@ module FSharp.Compiler.BuildGraph open System.Threading open System.Globalization +open Internal.Utilities.Library + [] module GraphNode = @@ -20,13 +22,13 @@ module GraphNode = | None -> () [] -type GraphNode<'T> private (computation: Async<'T>, cachedResult: ValueOption<'T>, cachedResultNode: Async<'T>) = +type internal GraphNode<'T> private (computation: Async2<'T>, cachedResult: ValueOption<'T>, cachedResultNode: Async2<'T>) = let mutable computation = computation let mutable requestCount = 0 let mutable cachedResult = cachedResult - let mutable cachedResultNode: Async<'T> = cachedResultNode + let mutable cachedResultNode: Async2<'T> = cachedResultNode let isCachedResultNodeNotNull () = not (obj.ReferenceEquals(cachedResultNode, null)) @@ -38,13 +40,15 @@ type GraphNode<'T> private (computation: Async<'T>, cachedResult: ValueOption<'T if isCachedResultNodeNotNull () then cachedResultNode else - async { - let! ct = Async.CancellationToken + async2 { + let! ct = Async2.CancellationToken Interlocked.Increment(&requestCount) |> ignore - let enter = semaphore.WaitAsync(ct) + + let mutable acquired = false try - do! enter |> Async.AwaitTask + do! semaphore.WaitAsync(ct) + acquired <- true match cachedResult with | ValueSome value -> return value @@ -52,17 +56,15 @@ type GraphNode<'T> private (computation: Async<'T>, cachedResult: ValueOption<'T Thread.CurrentThread.CurrentUICulture <- GraphNode.culture let! result = computation cachedResult <- ValueSome result - cachedResultNode <- async.Return result + cachedResultNode <- Async2.fromValue result computation <- Unchecked.defaultof<_> return result finally - // At this point, the semaphore awaiter is either already completed or about to get canceled. - // If calling Wait() does not throw an exception it means the semaphore was successfully taken and needs to be released. - try - enter.Wait() - semaphore.Release() |> ignore - with _ -> - () + if acquired then + try + semaphore.Release() |> ignore + with _ -> + () Interlocked.Decrement(&requestCount) |> ignore } @@ -74,7 +76,7 @@ type GraphNode<'T> private (computation: Async<'T>, cachedResult: ValueOption<'T member _.IsComputing = requestCount > 0 static member FromResult(result: 'T) = - let nodeResult = async.Return result + let nodeResult = Async2.fromValue result GraphNode(nodeResult, ValueSome result, nodeResult) new(computation) = GraphNode(computation, ValueNone, Unchecked.defaultof<_>) diff --git a/src/Compiler/Facilities/BuildGraph.fsi b/src/Compiler/Facilities/BuildGraph.fsi index 2b3016bf99b..b3d55dd91ff 100644 --- a/src/Compiler/Facilities/BuildGraph.fsi +++ b/src/Compiler/Facilities/BuildGraph.fsi @@ -2,6 +2,8 @@ module internal FSharp.Compiler.BuildGraph +open Internal.Utilities.Library + /// Contains helpers related to the build graph [] module internal GraphNode = @@ -18,7 +20,7 @@ module internal GraphNode = type internal GraphNode<'T> = /// - computation - The computation code to run. - new: computation: Async<'T> -> GraphNode<'T> + new: computation: Async2<'T> -> GraphNode<'T> /// Creates a GraphNode with given result already cached. static member FromResult: 'T -> GraphNode<'T> @@ -26,7 +28,7 @@ type internal GraphNode<'T> = /// Return NodeCode which, when executed, will get the value of the computation if already computed, or /// await an existing in-progress computation for the node if one exists, or else will synchronously /// start the computation on the current thread. - member GetOrComputeValue: unit -> Async<'T> + member GetOrComputeValue: unit -> Async2<'T> /// Return 'Some' if the computation has already been computed, else None if /// the computation is in-progress or has not yet been started. diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index 58d24ddaaa7..10de85ac5e8 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -937,6 +937,8 @@ module StackGuardMetrics = /// Guard against depth of expression nesting, by moving to new stack when a maximum depth is reached type StackGuard(name: string) = + do ignore name + let depth = new ThreadLocal() static member inline IsStackSufficient() = @@ -970,26 +972,16 @@ type StackGuard(name: string) = else let fileName = System.IO.Path.GetFileName(path) let depthWhenJump = depth.Value - StackGuardMetrics.countJump memberName $"{fileName}:{line}" depthWhenJump - async { - do! Async.SwitchToNewThread() - Thread.CurrentThread.Name <- $"F# Extra Compilation Thread for {name} (depth {depthWhenJump})" - return f () - } - |> Async.RunImmediate + async2 { return f () } |> Async2.runWithoutCancellation finally depth.Value <- depth.Value - 1 - [] - member x.GuardCancellable(original: Cancellable<'T>) = - Cancellable(fun ct -> x.Guard(fun () -> Cancellable.run ct original)) - // UseMultipleDiagnosticLoggers in ParseAndCheckProject.fs provides similar functionality. // We should probably adapt and reuse that code. module MultipleDiagnosticsLoggers = - let Parallel computations = + let Parallel (computations: Async2<_> seq) = let computationsWithLoggers, diagnosticsReady = [ for i, computation in computations |> Seq.indexed do @@ -999,7 +991,7 @@ module MultipleDiagnosticsLoggers = // Inject capturing logger into the computation. Signal the TaskCompletionSource when done. let computationsWithLoggers = - async { + async2 { SetThreadDiagnosticsLoggerNoUnwind logger try @@ -1022,11 +1014,11 @@ module MultipleDiagnosticsLoggers = finishedLogger.CommitDelayedDiagnostics target } - async { + async2 { try // We want to restore the current diagnostics context when finished. use _ = new CompilationGlobalsScope() - let! results = Async.Parallel computationsWithLoggers + let! results = Async2.Parallel computationsWithLoggers do! replayDiagnostics |> Async.AwaitTask return results finally @@ -1041,8 +1033,8 @@ module MultipleDiagnosticsLoggers = replayDiagnostics.Wait() } - let Sequential computations = - async { + let Sequential (computations: Async2<_> seq) = + async2 { let results = ResizeArray() for computation in computations do diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fsi b/src/Compiler/Facilities/DiagnosticsLogger.fsi index 7a083efae7e..0437baba08b 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fsi +++ b/src/Compiler/Facilities/DiagnosticsLogger.fsi @@ -9,6 +9,8 @@ open FSharp.Compiler.Text open System.Runtime.CompilerServices open System.Runtime.InteropServices +open Internal.Utilities.Library + /// Represents the style being used to format errors [] type DiagnosticStyle = @@ -475,8 +477,6 @@ type StackGuard = [] line: int -> 'T - member GuardCancellable: Internal.Utilities.Library.Cancellable<'T> -> Internal.Utilities.Library.Cancellable<'T> - /// This represents the global state established as each task function runs as part of the build. /// /// Use to reset error and warning handlers. @@ -497,7 +497,7 @@ module MultipleDiagnosticsLoggers = /// Run computations using Async.Parallel. /// Captures the diagnostics from each computation and commits them to the caller's logger preserving their order. /// When done, restores caller's build phase and diagnostics logger. - val Parallel: computations: Async<'T> seq -> Async<'T array> + val Parallel: computations: Async2<'T> seq -> Async2<'T array> /// Run computations sequentially starting immediately on the current thread. - val Sequential: computations: Async<'T> seq -> Async<'T array> + val Sequential: computations: Async2<'T> seq -> Async2<'T array> diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index ca96324426a..ba983ffb207 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -4691,7 +4691,7 @@ type FsiEvaluationSession unresolvedReferences, fsiOptions.DependencyProvider ) - |> Async.RunImmediate + |> Async2.RunSynchronously with e -> stopProcessingRecovery e range0 failwithf "Error creating evaluation session: %A" e @@ -4810,7 +4810,7 @@ type FsiEvaluationSession member _.ParseAndCheckInteraction(code) = fsiInteractionProcessor.ParseAndCheckInteraction(legacyReferenceResolver, fsiInteractionProcessor.CurrentState, code) - |> Cancellable.runWithoutCancellation + |> Async2.runWithoutCancellation member _.InteractiveChecker = checker diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 8c910806ede..7ccc33119f2 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -43,7 +43,7 @@ type internal IBackgroundCompiler = sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 /// Type-check the result obtained by parsing, but only if the antecedent type checking context is available. abstract member CheckFileInProjectAllowingStaleCachedResults: @@ -53,7 +53,7 @@ type internal IBackgroundCompiler = sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract member ClearCache: options: seq * userOpName: string -> unit @@ -65,28 +65,28 @@ type internal IBackgroundCompiler = abstract member FindReferencesInFile: fileName: string * options: FSharpProjectOptions * symbol: FSharpSymbol * canInvalidateProject: bool * userOpName: string -> - Async> + Async2> abstract member FindReferencesInFile: - fileName: string * projectSnapshot: FSharpProjectSnapshot * symbol: FSharpSymbol * userOpName: string -> Async> + fileName: string * projectSnapshot: FSharpProjectSnapshot * symbol: FSharpSymbol * userOpName: string -> Async2> abstract member GetAssemblyData: - options: FSharpProjectOptions * outputFileName: string * userOpName: string -> Async + options: FSharpProjectOptions * outputFileName: string * userOpName: string -> Async2 abstract member GetAssemblyData: - projectSnapshot: FSharpProjectSnapshot * outputFileName: string * userOpName: string -> Async + projectSnapshot: FSharpProjectSnapshot * outputFileName: string * userOpName: string -> Async2 /// Fetch the check information from the background compiler (which checks w.r.t. the FileSystem API) abstract member GetBackgroundCheckResultsForFileInProject: - fileName: string * options: FSharpProjectOptions * userOpName: string -> Async + fileName: string * options: FSharpProjectOptions * userOpName: string -> Async2 /// Fetch the parse information from the background compiler (which checks w.r.t. the FileSystem API) abstract member GetBackgroundParseResultsForFileInProject: - fileName: string * options: FSharpProjectOptions * userOpName: string -> Async + fileName: string * options: FSharpProjectOptions * userOpName: string -> Async2 abstract member GetCachedCheckFileResult: builder: IncrementalBuilder * fileName: string * sourceText: ISourceText * options: FSharpProjectOptions -> - Async<(FSharpParseFileResults * FSharpCheckFileResults) option> + Async2<(FSharpParseFileResults * FSharpCheckFileResults) option> abstract member GetProjectOptionsFromScript: fileName: string * @@ -101,7 +101,7 @@ type internal IBackgroundCompiler = assumeDotNetFramework: bool option * optionsStamp: int64 option * userOpName: string -> - Async + Async2 abstract GetProjectSnapshotFromScript: fileName: string * @@ -117,44 +117,44 @@ type internal IBackgroundCompiler = assumeDotNetFramework: bool option * optionsStamp: int64 option * userOpName: string -> - Async + Async2 abstract member GetSemanticClassificationForFile: fileName: string * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract member GetSemanticClassificationForFile: fileName: string * snapshot: FSharpProjectSnapshot * userOpName: string -> - Async + Async2 abstract member InvalidateConfiguration: options: FSharpProjectOptions * userOpName: string -> unit abstract InvalidateConfiguration: projectSnapshot: FSharpProjectSnapshot * userOpName: string -> unit - abstract member NotifyFileChanged: fileName: string * options: FSharpProjectOptions * userOpName: string -> Async + abstract member NotifyFileChanged: fileName: string * options: FSharpProjectOptions * userOpName: string -> Async2 - abstract member NotifyProjectCleaned: options: FSharpProjectOptions * userOpName: string -> Async + abstract member NotifyProjectCleaned: options: FSharpProjectOptions * userOpName: string -> Async2 /// Parses and checks the source file and returns untyped AST and check results. abstract member ParseAndCheckFileInProject: fileName: string * fileVersion: int * sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract member ParseAndCheckFileInProject: fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> - Async + Async2 /// Parse and typecheck the whole project. - abstract member ParseAndCheckProject: options: FSharpProjectOptions * userOpName: string -> Async + abstract member ParseAndCheckProject: options: FSharpProjectOptions * userOpName: string -> Async2 - abstract member ParseAndCheckProject: projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async + abstract member ParseAndCheckProject: projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async2 abstract member ParseFile: fileName: string * sourceText: ISourceText * options: FSharpParsingOptions * cache: bool * flatErrors: bool * userOpName: string -> - Async + Async2 abstract member ParseFile: - fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async + fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async2 /// Try to get recent approximate type check results for a file. abstract member TryGetRecentCheckResultsForFile: @@ -295,7 +295,7 @@ type internal BackgroundCompiler then { new IProjectReference with member x.EvaluateRawContents() = - async { + async2 { Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "GetAssemblyData", nm) return! self.GetAssemblyData(opts, userOpName + ".CheckReferencedProject(" + nm + ")") } @@ -309,7 +309,7 @@ type internal BackgroundCompiler | FSharpReferencedProject.PEReference(getStamp, delayedReader) -> { new IProjectReference with member x.EvaluateRawContents() = - cancellable { + async2 { let! ilReaderOpt = delayedReader.TryGetILModuleReader() match ilReaderOpt with @@ -322,7 +322,6 @@ type internal BackgroundCompiler // continue to try to use an on-disk DLL return ProjectAssemblyDataResult.Unavailable false } - |> Cancellable.toAsync member x.TryGetLogicalTimeStamp _ = getStamp () |> Some member x.FileName = delayedReader.OutputFile @@ -331,13 +330,12 @@ type internal BackgroundCompiler | FSharpReferencedProject.ILModuleReference(nm, getStamp, getReader) -> { new IProjectReference with member x.EvaluateRawContents() = - cancellable { + async2 { let ilReader = getReader () let ilModuleDef, ilAsmRefs = ilReader.ILModuleDef, ilReader.ILAssemblyRefs let data = RawFSharpAssemblyData(ilModuleDef, ilAsmRefs) :> IRawFSharpAssemblyData return ProjectAssemblyDataResult.Available data } - |> Cancellable.toAsync member x.TryGetLogicalTimeStamp _ = getStamp () |> Some member x.FileName = nm @@ -347,7 +345,7 @@ type internal BackgroundCompiler /// CreateOneIncrementalBuilder (for background type checking). Note that fsc.fs also /// creates an incremental builder used by the command line compiler. let CreateOneIncrementalBuilder (options: FSharpProjectOptions, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.CreateOneIncrementalBuilder" [| Activity.Tags.project, options.ProjectFileName |] @@ -453,14 +451,14 @@ type internal BackgroundCompiler let tryGetBuilderNode options = incrementalBuildersCache.TryGet(AnyCallerThread, options) - let tryGetBuilder options : Async option = + let tryGetBuilder options : Async2 option = tryGetBuilderNode options |> Option.map (fun x -> x.GetOrComputeValue()) - let tryGetSimilarBuilder options : Async option = + let tryGetSimilarBuilder options : Async2 option = incrementalBuildersCache.TryGetSimilar(AnyCallerThread, options) |> Option.map (fun x -> x.GetOrComputeValue()) - let tryGetAnyBuilder options : Async option = + let tryGetAnyBuilder options : Async2 option = incrementalBuildersCache.TryGetAny(AnyCallerThread, options) |> Option.map (fun x -> x.GetOrComputeValue()) @@ -474,16 +472,14 @@ type internal BackgroundCompiler getBuilderNode) let createAndGetBuilder (options, userOpName) = - async { - let! ct = Async.CancellationToken + async2 { + let! ct = Async2.CancellationToken let getBuilderNode = createBuilderNode (options, userOpName, ct) return! getBuilderNode.GetOrComputeValue() } - let getOrCreateBuilder (options, userOpName) : Async = - async { - use! _holder = Cancellable.UseToken() - + let getOrCreateBuilder (options, userOpName) : Async2 = + async2 { match tryGetBuilder options with | Some getBuilder -> match! getBuilder with @@ -537,7 +533,7 @@ type internal BackgroundCompiler | _ -> let res = GraphNode( - async { + async2 { let! res = self.CheckOneFileImplAux( parseResults, @@ -561,7 +557,7 @@ type internal BackgroundCompiler member _.ParseFile (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.ParseFile" @@ -578,7 +574,7 @@ type internal BackgroundCompiler | Some res -> return res | None -> Interlocked.Increment(&actualParseFileCount) |> ignore - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let parseDiagnostics, parseTree, anyErrors = ParseAndCheckFile.parseFile ( @@ -598,7 +594,7 @@ type internal BackgroundCompiler parseCacheLock.AcquireLock(fun ltok -> parseFileCache.Set(ltok, (fileName, hash, options), res)) return res else - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let parseDiagnostics, parseTree, anyErrors = ParseAndCheckFile.parseFile ( @@ -617,7 +613,7 @@ type internal BackgroundCompiler /// Fetch the parse information from the background compiler (which checks w.r.t. the FileSystem API) member _.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.GetBackgroundParseResultsForFileInProject" @@ -657,7 +653,7 @@ type internal BackgroundCompiler } member _.GetCachedCheckFileResult(builder: IncrementalBuilder, fileName, sourceText: ISourceText, options) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.GetCachedCheckFileResult" [| Activity.Tags.fileName, fileName |] @@ -694,9 +690,9 @@ type internal BackgroundCompiler tcPrior: PartialCheckResults, tcInfo: TcInfo, creationDiags: FSharpDiagnostic[] - ) : Async = + ) : Async2 = - async { + async2 { // Get additional script #load closure information if applicable. // For scripts, this will have been recorded by GetProjectOptionsFromScript. let tcConfig = tcPrior.TcConfig @@ -724,7 +720,7 @@ type internal BackgroundCompiler keepAssemblyContents, suggestNamesForErrors ) - |> Cancellable.toAsync + |> Async2.toAsync GraphNode.SetPreferredUILang tcConfig.preferredUiLang return (parseResults, checkAnswer, sourceText.GetHashCode() |> int64, tcPrior.ProjectTimeStamp) @@ -743,7 +739,7 @@ type internal BackgroundCompiler creationDiags: FSharpDiagnostic[] ) = - async { + async2 { match! bc.GetCachedCheckFileResult(builder, fileName, sourceText, options) with | Some(_, results) -> return FSharpCheckFileAnswer.Succeeded results | _ -> @@ -758,7 +754,7 @@ type internal BackgroundCompiler member bc.CheckFileInProjectAllowingStaleCachedResults (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.CheckFileInProjectAllowingStaleCachedResults" @@ -769,7 +765,7 @@ type internal BackgroundCompiler |] let! cachedResults = - async { + async2 { let! builderOpt, creationDiags = getAnyBuilder (options, userOpName) match builderOpt with @@ -812,7 +808,7 @@ type internal BackgroundCompiler member bc.CheckFileInProject (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.CheckFileInProject" @@ -855,7 +851,7 @@ type internal BackgroundCompiler member bc.ParseAndCheckFileInProject (fileName: string, fileVersion, sourceText: ISourceText, options: FSharpProjectOptions, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.ParseAndCheckFileInProject" @@ -890,7 +886,7 @@ type internal BackgroundCompiler ) GraphNode.SetPreferredUILang tcPrior.TcConfig.preferredUiLang - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let parseDiagnostics, parseTree, anyErrors = ParseAndCheckFile.parseFile ( @@ -924,7 +920,7 @@ type internal BackgroundCompiler } member _.NotifyFileChanged(fileName, options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.NotifyFileChanged" @@ -943,7 +939,7 @@ type internal BackgroundCompiler /// Fetch the check information from the background compiler (which checks w.r.t. the FileSystem API) member _.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.ParseAndCheckFileInProject" @@ -1050,7 +1046,7 @@ type internal BackgroundCompiler member _.FindReferencesInFile (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.FindReferencesInFile" @@ -1078,7 +1074,7 @@ type internal BackgroundCompiler } member _.GetSemanticClassificationForFile(fileName: string, options: FSharpProjectOptions, userOpName: string) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.GetSemanticClassificationForFile" @@ -1141,7 +1137,7 @@ type internal BackgroundCompiler /// Parse and typecheck the whole project (the implementation, called recursively as project graph is evaluated) member private _.ParseAndCheckProjectImpl(options, userOpName) = - async { + async2 { let! builderOpt, creationDiags = getOrCreateBuilder (options, userOpName) @@ -1214,7 +1210,7 @@ type internal BackgroundCompiler } member _.GetAssemblyData(options, userOpName) = - async { + async2 { use _ = Activity.start "BackgroundCompiler.GetAssemblyData" @@ -1273,7 +1269,7 @@ type internal BackgroundCompiler "BackgroundCompiler.GetProjectOptionsFromScript" [| Activity.Tags.fileName, fileName; Activity.Tags.userOpName, _userOpName |] - cancellable { + async2 { // Do we add a reference to FSharp.Compiler.Interactive.Settings by default? let useFsiAuxLib = defaultArg useFsiAuxLib true let useSdkRefs = defaultArg useSdkRefs true @@ -1356,7 +1352,6 @@ type internal BackgroundCompiler return options, (diags @ diagnostics.Diagnostics) } - |> Cancellable.toAsync member bc.InvalidateConfiguration(options: FSharpProjectOptions, userOpName) = use _ = @@ -1397,9 +1392,9 @@ type internal BackgroundCompiler Activity.Tags.userOpName, userOpName |] - async { + async2 { - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken // If there was a similar entry (as there normally will have been) then re-establish an empty builder . This // is a somewhat arbitrary choice - it will have the effect of releasing memory associated with the previous // builder, but costs some time. @@ -1458,8 +1453,8 @@ type internal BackgroundCompiler sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string - ) : Async = - async { + ) : Async2 = + async2 { ignore parseResults let! _, result = this.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) @@ -1475,7 +1470,7 @@ type internal BackgroundCompiler sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string - ) : Async = + ) : Async2 = self.CheckFileInProjectAllowingStaleCachedResults(parseResults, fileName, fileVersion, sourceText, options, userOpName) member _.ClearCache(options: seq, userOpName: string) : unit = self.ClearCache(options, userOpName) @@ -1489,7 +1484,7 @@ type internal BackgroundCompiler member _.FindReferencesInFile (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) - : Async> = + : Async2> = self.FindReferencesInFile(fileName, options, symbol, canInvalidateProject, userOpName) member this.FindReferencesInFile(fileName, projectSnapshot, symbol, userOpName) = @@ -1497,27 +1492,27 @@ type internal BackgroundCompiler member _.FrameworkImportsCache: FrameworkImportsCache = self.FrameworkImportsCache - member _.GetAssemblyData(options: FSharpProjectOptions, _fileName: string, userOpName: string) : Async = + member _.GetAssemblyData(options: FSharpProjectOptions, _fileName: string, userOpName: string) : Async2 = self.GetAssemblyData(options, userOpName) member _.GetAssemblyData (projectSnapshot: FSharpProjectSnapshot, _fileName: string, userOpName: string) - : Async = + : Async2 = self.GetAssemblyData(projectSnapshot.ToOptions(), userOpName) member _.GetBackgroundCheckResultsForFileInProject (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = + : Async2 = self.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) member _.GetBackgroundParseResultsForFileInProject (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = + : Async2 = self.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) member _.GetCachedCheckFileResult (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) - : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + : Async2<(FSharpParseFileResults * FSharpCheckFileResults) option> = self.GetCachedCheckFileResult(builder, fileName, sourceText, options) member _.GetProjectOptionsFromScript @@ -1534,7 +1529,7 @@ type internal BackgroundCompiler assumeDotNetFramework: bool option, optionsStamp: int64 option, userOpName: string - ) : Async = + ) : Async2 = self.GetProjectOptionsFromScript( fileName, sourceText, @@ -1565,8 +1560,8 @@ type internal BackgroundCompiler assumeDotNetFramework: bool option, optionsStamp: int64 option, userOpName: string - ) : Async = - async { + ) : Async2 = + async2 { let! options, diagnostics = self.GetProjectOptionsFromScript( fileName, @@ -1589,12 +1584,12 @@ type internal BackgroundCompiler member _.GetSemanticClassificationForFile (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = + : Async2 = self.GetSemanticClassificationForFile(fileName, options, userOpName) member _.GetSemanticClassificationForFile (fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) - : Async = + : Async2 = self.GetSemanticClassificationForFile(fileName, snapshot.ToOptions(), userOpName) member _.InvalidateConfiguration(options: FSharpProjectOptions, userOpName: string) : unit = @@ -1604,35 +1599,35 @@ type internal BackgroundCompiler let options = projectSnapshot.ToOptions() self.InvalidateConfiguration(options, userOpName) - member _.NotifyFileChanged(fileName: string, options: FSharpProjectOptions, userOpName: string) : Async = + member _.NotifyFileChanged(fileName: string, options: FSharpProjectOptions, userOpName: string) : Async2 = self.NotifyFileChanged(fileName, options, userOpName) - member _.NotifyProjectCleaned(options: FSharpProjectOptions, userOpName: string) : Async = + member _.NotifyProjectCleaned(options: FSharpProjectOptions, userOpName: string) : Async2 = self.NotifyProjectCleaned(options, userOpName) member _.ParseAndCheckFileInProject (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) - : Async = + : Async2 = self.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) member _.ParseAndCheckFileInProject (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) - : Async = - async { + : Async2 = + async2 { let fileSnapshot = projectSnapshot.ProjectSnapshot.SourceFiles |> Seq.find (fun f -> f.FileName = fileName) - let! sourceText = fileSnapshot.GetSource() |> Async.AwaitTask + let! sourceText = fileSnapshot.GetSource() let options = projectSnapshot.ToOptions() return! self.ParseAndCheckFileInProject(fileName, 0, sourceText, options, userOpName) } - member _.ParseAndCheckProject(options: FSharpProjectOptions, userOpName: string) : Async = + member _.ParseAndCheckProject(options: FSharpProjectOptions, userOpName: string) : Async2 = self.ParseAndCheckProject(options, userOpName) - member _.ParseAndCheckProject(projectSnapshot: FSharpProjectSnapshot, userOpName: string) : Async = + member _.ParseAndCheckProject(projectSnapshot: FSharpProjectSnapshot, userOpName: string) : Async2 = self.ParseAndCheckProject(projectSnapshot.ToOptions(), userOpName) member _.ParseFile diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index 30c008c2ed5..a5e53547634 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -5,6 +5,8 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Diagnostics +open Internal.Utilities.Library + type SourceTextHash = int64 type CacheStamp = int64 @@ -29,7 +31,7 @@ type internal IBackgroundCompiler = sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 /// Type-check the result obtained by parsing, but only if the antecedent type checking context is available. abstract CheckFileInProjectAllowingStaleCachedResults: @@ -39,7 +41,7 @@ type internal IBackgroundCompiler = sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract ClearCache: options: FSharpProjectOptions seq * userOpName: string -> unit @@ -54,7 +56,7 @@ type internal IBackgroundCompiler = projectSnapshot: FSharpProjectSnapshot * symbol: FSharp.Compiler.Symbols.FSharpSymbol * userOpName: string -> - Async + Async2 abstract FindReferencesInFile: fileName: string * @@ -62,27 +64,27 @@ type internal IBackgroundCompiler = symbol: FSharp.Compiler.Symbols.FSharpSymbol * canInvalidateProject: bool * userOpName: string -> - Async + Async2 abstract GetAssemblyData: projectSnapshot: FSharpProjectSnapshot * outputFileName: string * userOpName: string -> - Async + Async2 abstract GetAssemblyData: - options: FSharpProjectOptions * outputFileName: string * userOpName: string -> Async + options: FSharpProjectOptions * outputFileName: string * userOpName: string -> Async2 /// Fetch the check information from the background compiler (which checks w.r.t. the FileSystem API) abstract GetBackgroundCheckResultsForFileInProject: fileName: string * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 /// Fetch the parse information from the background compiler (which checks w.r.t. the FileSystem API) abstract GetBackgroundParseResultsForFileInProject: - fileName: string * options: FSharpProjectOptions * userOpName: string -> Async + fileName: string * options: FSharpProjectOptions * userOpName: string -> Async2 abstract GetCachedCheckFileResult: builder: IncrementalBuilder * fileName: string * sourceText: ISourceText * options: FSharpProjectOptions -> - Async<(FSharpParseFileResults * FSharpCheckFileResults) option> + Async2<(FSharpParseFileResults * FSharpCheckFileResults) option> abstract GetProjectOptionsFromScript: fileName: string * @@ -97,7 +99,7 @@ type internal IBackgroundCompiler = assumeDotNetFramework: bool option * optionsStamp: int64 option * userOpName: string -> - Async + Async2 abstract GetProjectSnapshotFromScript: fileName: string * @@ -113,27 +115,27 @@ type internal IBackgroundCompiler = assumeDotNetFramework: bool option * optionsStamp: int64 option * userOpName: string -> - Async + Async2 abstract GetSemanticClassificationForFile: fileName: string * snapshot: FSharpProjectSnapshot * userOpName: string -> - Async + Async2 abstract GetSemanticClassificationForFile: fileName: string * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract InvalidateConfiguration: options: FSharpProjectOptions * userOpName: string -> unit abstract InvalidateConfiguration: projectSnapshot: FSharpProjectSnapshot * userOpName: string -> unit - abstract NotifyFileChanged: fileName: string * options: FSharpProjectOptions * userOpName: string -> Async + abstract NotifyFileChanged: fileName: string * options: FSharpProjectOptions * userOpName: string -> Async2 - abstract NotifyProjectCleaned: options: FSharpProjectOptions * userOpName: string -> Async + abstract NotifyProjectCleaned: options: FSharpProjectOptions * userOpName: string -> Async2 abstract ParseAndCheckFileInProject: fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> - Async + Async2 /// Parses and checks the source file and returns untyped AST and check results. abstract ParseAndCheckFileInProject: @@ -142,17 +144,17 @@ type internal IBackgroundCompiler = sourceText: ISourceText * options: FSharpProjectOptions * userOpName: string -> - Async + Async2 abstract ParseAndCheckProject: - projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async + projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async2 /// Parse and typecheck the whole project. abstract ParseAndCheckProject: - options: FSharpProjectOptions * userOpName: string -> Async + options: FSharpProjectOptions * userOpName: string -> Async2 abstract ParseFile: - fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async + fileName: string * projectSnapshot: FSharpProjectSnapshot * userOpName: string -> Async2 abstract ParseFile: fileName: string * @@ -161,7 +163,7 @@ type internal IBackgroundCompiler = cache: bool * flatErrors: bool * userOpName: string -> - Async + Async2 /// Try to get recent approximate type check results for a file. abstract TryGetRecentCheckResultsForFile: diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 584591c059c..8239c06cb4f 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -83,8 +83,8 @@ type DelayedILModuleReader = // fast path match box this.result with | null -> - cancellable { - let! ct = Cancellable.token () + async2 { + let! ct = Async2.CancellationToken return lock this.gate (fun () -> @@ -114,7 +114,7 @@ type DelayedILModuleReader = None | _ -> Some this.result) } - | _ -> cancellable.Return(Some this.result) + | _ -> async2 { return Some this.result } [] type FSharpReferencedProject = @@ -3277,7 +3277,7 @@ module internal ParseAndCheckFile = suggestNamesForErrors: bool ) = - cancellable { + async2 { use _ = Activity.start "ParseAndCheckFile.CheckOneFile" @@ -3303,7 +3303,7 @@ module internal ParseAndCheckFile = let sink = TcResultsSinkImpl(tcGlobals, sourceText = sourceText) let! resOpt = - cancellable { + async2 { try let checkForErrors () = (parseResults.ParseHadErrors || errHandler.ErrorCount > 0) @@ -3755,7 +3755,7 @@ type FSharpCheckFileResults keepAssemblyContents: bool, suggestNamesForErrors: bool ) = - cancellable { + async2 { let! tcErrors, tcFileInfo = ParseAndCheckFile.CheckOneFile( parseResults, @@ -3995,7 +3995,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal let keepAssemblyContents = false member _.ParseAndCheckInteraction(sourceText: ISourceText, ?userOpName: string) = - cancellable { + async2 { let userOpName = defaultArg userOpName "Unknown" let fileName = Path.Combine(tcConfig.implicitIncludeDir, "stdin.fsx") let suggestNamesForErrors = true // Will always be true, this is just for readability @@ -4003,7 +4003,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, [| fileName |], true) - let! ct = Cancellable.token () + let! ct = Async2.CancellationToken let parseErrors, parsedInput, anyErrors = ParseAndCheckFile.parseFile ( diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index 28deec6804a..4789952241d 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -42,7 +42,7 @@ type DelayedILModuleReader = /// Will lazily create the ILModuleReader. /// Is only evaluated once and can be called by multiple threads. - member internal TryGetILModuleReader: unit -> Cancellable + member internal TryGetILModuleReader: unit -> Async2 /// Unused in this API type public FSharpUnresolvedReferencesSet = internal FSharpUnresolvedReferencesSet of UnresolvedAssemblyReference list @@ -508,7 +508,7 @@ type public FSharpCheckFileResults = parseErrors: FSharpDiagnostic[] * keepAssemblyContents: bool * suggestNamesForErrors: bool -> - Cancellable + Async2 /// The result of calling TypeCheckResult including the possibility of abort and background compiler not caught up. and [] public FSharpCheckFileAnswer = @@ -625,7 +625,7 @@ type internal FsiInteractiveChecker = member internal ParseAndCheckInteraction: sourceText: ISourceText * ?userOpName: string -> - Cancellable + Async2 module internal FSharpCheckerResultsSettings = val defaultFSharpBinariesDir: string diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index 2183ca75e87..e894ff374c1 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -655,33 +655,32 @@ and [] FSha ProjectSnapshotBase(projectConfig, referencedProjects, sourceFiles) |> FSharpProjectSnapshot - static member FromOptions(options: FSharpProjectOptions, getFileSnapshot, ?snapshotAccumulator) = + static member FromOptions(options: FSharpProjectOptions, getFileSnapshot: _ -> _ -> Async<_>, ?snapshotAccumulator) : Async<_> = let snapshotAccumulator = defaultArg snapshotAccumulator (Dictionary()) - async { + async2 { // TODO: check if options is a good key here if not (snapshotAccumulator.ContainsKey options) then let! sourceFiles = options.SourceFiles - |> Seq.map (getFileSnapshot options) + |> Seq.map (fun name -> async2 { return! getFileSnapshot options name }) |> MultipleDiagnosticsLoggers.Parallel let! referencedProjects = options.ReferencedProjects |> Seq.map (function | FSharpReferencedProject.FSharpReference(outputName, options) -> - async { + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, getFileSnapshot, snapshotAccumulator) return FSharpReferencedProjectSnapshot.FSharpReference(outputName, snapshot) } | FSharpReferencedProject.PEReference(getStamp, reader) -> - async.Return <| FSharpReferencedProjectSnapshot.PEReference(getStamp, reader) + async2 { return FSharpReferencedProjectSnapshot.PEReference(getStamp, reader) } | FSharpReferencedProject.ILModuleReference(outputName, getStamp, getReader) -> - async.Return - <| FSharpReferencedProjectSnapshot.ILModuleReference(outputName, getStamp, getReader)) + async2 { return FSharpReferencedProjectSnapshot.ILModuleReference(outputName, getStamp, getReader) }) |> MultipleDiagnosticsLoggers.Sequential @@ -719,6 +718,7 @@ and [] FSha return snapshotAccumulator[options] } + |> Async2.toAsync static member FromOptions(options: FSharpProjectOptions, documentSource: DocumentSource) = FSharpProjectSnapshot.FromOptions( diff --git a/src/Compiler/Service/FSharpSource.fs b/src/Compiler/Service/FSharpSource.fs index bfdab00d690..1a854db0d6a 100644 --- a/src/Compiler/Service/FSharpSource.fs +++ b/src/Compiler/Service/FSharpSource.fs @@ -6,6 +6,7 @@ open System open System.IO open FSharp.Compiler.IO open FSharp.Compiler.Text +open Internal.Utilities.Library [] type TextContainer = @@ -27,7 +28,7 @@ type FSharpSource internal () = abstract TimeStamp: DateTime - abstract GetTextContainer: unit -> Async + abstract GetTextContainer: unit -> Async2 type private FSharpSourceMemoryMappedFile(filePath: string, timeStamp: DateTime, openStream: unit -> Stream) = inherit FSharpSource() @@ -37,7 +38,7 @@ type private FSharpSourceMemoryMappedFile(filePath: string, timeStamp: DateTime, override _.TimeStamp = timeStamp override _.GetTextContainer() = - openStream () |> TextContainer.Stream |> async.Return + async2 { return openStream () |> TextContainer.Stream } type private FSharpSourceByteArray(filePath: string, timeStamp: DateTime, bytes: byte[]) = inherit FSharpSource() @@ -47,8 +48,7 @@ type private FSharpSourceByteArray(filePath: string, timeStamp: DateTime, bytes: override _.TimeStamp = timeStamp override _.GetTextContainer() = - TextContainer.Stream(new MemoryStream(bytes, 0, bytes.Length, false) :> Stream) - |> async.Return + async2 { return TextContainer.Stream(new MemoryStream(bytes, 0, bytes.Length, false) :> Stream) } type private FSharpSourceFromFile(filePath: string) = inherit FSharpSource() @@ -57,9 +57,9 @@ type private FSharpSourceFromFile(filePath: string) = override _.TimeStamp = FileSystem.GetLastWriteTimeShim(filePath) - override _.GetTextContainer() = TextContainer.OnDisk |> async.Return + override _.GetTextContainer() = async2 { return TextContainer.OnDisk } -type private FSharpSourceCustom(filePath: string, getTimeStamp, getSourceText) = +type private FSharpSourceCustom(filePath: string, getTimeStamp, getSourceText: unit -> Async) = inherit FSharpSource() override _.FilePath = filePath @@ -67,7 +67,7 @@ type private FSharpSourceCustom(filePath: string, getTimeStamp, getSourceText) = override _.TimeStamp = getTimeStamp () override _.GetTextContainer() = - async { + async2 { let! sourceOpt = getSourceText () return diff --git a/src/Compiler/Service/FSharpSource.fsi b/src/Compiler/Service/FSharpSource.fsi index 6bdabbdedf1..abe31eaf7cc 100644 --- a/src/Compiler/Service/FSharpSource.fsi +++ b/src/Compiler/Service/FSharpSource.fsi @@ -5,6 +5,7 @@ namespace FSharp.Compiler.CodeAnalysis open System open System.IO open FSharp.Compiler.Text +open Internal.Utilities.Library [] type internal TextContainer = @@ -26,7 +27,7 @@ type internal FSharpSource = abstract TimeStamp: DateTime /// Gets the internal text container. Text may be on-disk, in a stream, or a source text. - abstract GetTextContainer: unit -> Async + abstract GetTextContainer: unit -> Async2 /// Creates a FSharpSource from disk. Only used internally. static member internal CreateFromFile: filePath: string -> FSharpSource diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index 6db19653f9a..4d34e62bed4 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -136,7 +136,7 @@ module IncrementalBuildSyntaxTree = ), sourceRange, fileName, [||] let parse (source: FSharpSource) = - async { + async2 { IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBEParsed fileName) use _ = Activity.start "IncrementalBuildSyntaxTree.parse" @@ -247,8 +247,8 @@ type BoundModel private ( ?tcStateOpt: GraphNode * GraphNode ) = - let getTypeCheck (syntaxTree: SyntaxTree) : Async = - async { + let getTypeCheck (syntaxTree: SyntaxTree) : Async2 = + async2 { let! input, _sourceRange, fileName, parseErrors = syntaxTree.ParseNode.GetOrComputeValue() use _ = Activity.start "BoundModel.TypeCheck" [|Activity.Tags.fileName, fileName|] @@ -272,7 +272,6 @@ type BoundModel private ( None, TcResultsSink.WithSink sink, prevTcInfo.tcState, input ) - |> Cancellable.toAsync fileChecked.Trigger fileName @@ -317,13 +316,13 @@ type BoundModel private ( | _ -> None let getTcInfo (typeCheck: GraphNode) = - async { + async2 { let! tcInfo , _, _, _, _ = typeCheck.GetOrComputeValue() return tcInfo } |> GraphNode let getTcInfoExtras (typeCheck: GraphNode) = - async { + async2 { let! _ , sink, implFile, fileName, _ = typeCheck.GetOrComputeValue() // Build symbol keys let itemKeyStore, semanticClassification = @@ -361,17 +360,17 @@ type BoundModel private ( } } |> GraphNode - let defaultTypeCheck = async { return prevTcInfo, TcResultsSinkImpl(tcGlobals), None, "default typecheck - no syntaxTree", [||] } + let defaultTypeCheck = async2 { return prevTcInfo, TcResultsSinkImpl(tcGlobals), None, "default typecheck - no syntaxTree", [||] } let typeCheckNode = syntaxTreeOpt |> Option.map getTypeCheck |> Option.defaultValue defaultTypeCheck |> GraphNode let tcInfoExtras = getTcInfoExtras typeCheckNode let diagnostics = - async { + async2 { let! _, _, _, _, diags = typeCheckNode.GetOrComputeValue() return diags } |> GraphNode let startComputingFullTypeCheck = - async { + async2 { let! _ = tcInfoExtras.GetOrComputeValue() return! diagnostics.GetOrComputeValue() } @@ -386,7 +385,7 @@ type BoundModel private ( GraphNode.FromResult tcInfo, tcInfoExtras | _ -> // start computing extras, so that typeCheckNode can be GC'd quickly - startComputingFullTypeCheck |> Async.Catch |> Async.Ignore |> Async.Start + startComputingFullTypeCheck |> Async2.Catch |> Async2.Ignore |> Async2.Start getTcInfo typeCheckNode, tcInfoExtras member val Diagnostics = diagnostics @@ -412,13 +411,13 @@ type BoundModel private ( member this.GetOrComputeTcInfoExtras = this.TcInfoExtras.GetOrComputeValue - member this.GetOrComputeTcInfoWithExtras() = async { + member this.GetOrComputeTcInfoWithExtras() = async2 { let! tcInfo = this.TcInfo.GetOrComputeValue() let! tcInfoExtras = this.TcInfoExtras.GetOrComputeValue() return tcInfo, tcInfoExtras } - member this.Next(syntaxTree) = async { + member this.Next(syntaxTree) = async2 { let! tcInfo = this.TcInfo.GetOrComputeValue() return BoundModel( @@ -437,7 +436,7 @@ type BoundModel private ( } member this.Finish(finalTcDiagnosticsRev, finalTopAttribs) = - async { + async2 { let! tcInfo = this.TcInfo.GetOrComputeValue() let finishState = { tcInfo with tcDiagnosticsRev = finalTcDiagnosticsRev; topAttribs = finalTopAttribs } return @@ -534,7 +533,7 @@ type FrameworkImportsCache(size) = match frameworkTcImportsCache.TryGet (AnyCallerThread, key) with | Some lazyWork -> lazyWork | None -> - let lazyWork = GraphNode(async { + let lazyWork = GraphNode(async2 { let tcConfigP = TcConfigProvider.Constant tcConfig return! TcImports.BuildFrameworkTcImports (tcConfigP, frameworkDLLs, nonFrameworkResolutions) }) @@ -546,7 +545,7 @@ type FrameworkImportsCache(size) = /// This function strips the "System" assemblies from the tcConfig and returns a age-cached TcImports for them. member this.Get(tcConfig: TcConfig) = - async { + async2 { // Split into installed and not installed. let frameworkDLLs, nonFrameworkResolutions, unresolved = TcAssemblyResolutions.SplitNonFoundationalResolutions(tcConfig) let node = this.GetNode(tcConfig, frameworkDLLs, nonFrameworkResolutions) @@ -581,6 +580,7 @@ type FrameworkImportsCache(size) = return tcGlobals, frameworkTcImports, nonFrameworkResolutions, unresolved } + |> Async2.toAsync /// Represents the interim state of checking an assembly [] @@ -600,21 +600,23 @@ type PartialCheckResults (boundModel: BoundModel, timeStamp: DateTime, projectTi member _.TryPeekTcInfoWithExtras() = boundModel.TryPeekTcInfoWithExtras() - member _.GetOrComputeTcInfo() = boundModel.GetOrComputeTcInfo() + member _.GetOrComputeTcInfo() = boundModel.GetOrComputeTcInfo() |> Async2.toAsync - member _.GetOrComputeTcInfoWithExtras() = boundModel.GetOrComputeTcInfoWithExtras() + member _.GetOrComputeTcInfoWithExtras() = boundModel.GetOrComputeTcInfoWithExtras() |> Async2.toAsync member _.GetOrComputeItemKeyStoreIfEnabled() = - async { + async2 { let! info = boundModel.GetOrComputeTcInfoExtras() return info.itemKeyStore } + |> Async2.toAsync member _.GetOrComputeSemanticClassificationIfEnabled() = - async { + async2 { let! info = boundModel.GetOrComputeTcInfoExtras() return info.semanticClassificationKeyStore } + |> Async2.toAsync [] module Utilities = @@ -682,14 +684,14 @@ module IncrementalBuilderHelpers = #if !NO_TYPEPROVIDERS ,importsInvalidatedByTypeProvider: Event #endif - ) : Async = + ) : Async2 = - async { + async2 { let diagnosticsLogger = CompilationDiagnosticLogger("CombineImportedAssembliesTask", tcConfig.diagnosticsOptions) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.Parameter) let! tcImports = - async { + async2 { try let! tcImports = TcImports.BuildNonFrameworkTcImports(tcConfigP, frameworkTcImports, nonFrameworkResolutions, unresolvedReferences, dependencyProvider) #if !NO_TYPEPROVIDERS @@ -760,7 +762,7 @@ module IncrementalBuilderHelpers = /// Finish up the typechecking to produce outputs for the rest of the compilation process let FinalizeTypeCheckTask (tcConfig: TcConfig) tcGlobals partialCheck assemblyName outfile (boundModels: GraphNode seq) = - async { + async2 { let diagnosticsLogger = CompilationDiagnosticLogger("FinalizeTypeCheckTask", tcConfig.diagnosticsOptions) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.TypeCheck) @@ -768,13 +770,13 @@ module IncrementalBuilderHelpers = let! tcInfos = computedBoundModels - |> Seq.map (fun boundModel -> async { return! boundModel.GetOrComputeTcInfo() }) + |> Seq.map (fun boundModel -> async2 { return! boundModel.GetOrComputeTcInfo() }) |> MultipleDiagnosticsLoggers.Sequential // tcInfoExtras can be computed in parallel. This will check any previously skipped implementation files in parallel, too. let! latestImplFiles = computedBoundModels - |> Seq.map (fun boundModel -> async { + |> Seq.map (fun boundModel -> async2 { if partialCheck then return None else @@ -970,13 +972,13 @@ module IncrementalBuilderStateHelpers = type BuildStatus = Invalidated | Good let createBoundModelGraphNode (prevBoundModel: GraphNode) syntaxTree = - GraphNode(async { + GraphNode(async2 { let! prevBoundModel = prevBoundModel.GetOrComputeValue() return! prevBoundModel.Next(syntaxTree) }) let createFinalizeBoundModelGraphNode (initialState: IncrementalBuilderInitialState) (boundModels: GraphNode seq) = - GraphNode(async { + GraphNode(async2 { use _ = Activity.start "GetCheckResultsAndImplementationsForProject" [|Activity.Tags.project, initialState.outfile|] let! result = FinalizeTypeCheckTask @@ -1144,7 +1146,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc tryGetSlot state (slot - 1) let evalUpToTargetSlot (state: IncrementalBuilderState) targetSlot = - async { + async2 { if targetSlot < 0 then return Some(initialBoundModel, defaultTimeStamp) else @@ -1175,9 +1177,10 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc let mutable currentState = state - let setCurrentState state cache (ct: CancellationToken) = - async { - do! semaphore.WaitAsync(ct) |> Async.AwaitTask + let setCurrentState state cache = + async2 { + let! ct = Async2.CancellationToken + do! semaphore.WaitAsync(ct) try ct.ThrowIfCancellationRequested() currentState <- computeStampedFileNames initialState state cache @@ -1185,11 +1188,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc semaphore.Release() |> ignore } - let checkFileTimeStamps (cache: TimeStampCache) = - async { - let! ct = Async.CancellationToken - do! setCurrentState currentState cache ct - } + let checkFileTimeStamps (cache: TimeStampCache) = setCurrentState currentState cache do IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBECreated) @@ -1217,12 +1216,13 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc member _.AllDependenciesDeprecated = allDependencies member _.PopulatePartialCheckingResults () = - async { + async2 { let cache = TimeStampCache defaultTimeStamp // One per step do! checkFileTimeStamps cache let! _ = currentState.finalizedBoundModel.GetOrComputeValue() projectChecked.Trigger() } + |> Async2.toAsync member builder.GetCheckResultsBeforeFileInProjectEvenIfStale fileName: PartialCheckResults option = let slotOfFile = builder.GetSlotOfFileName fileName @@ -1259,7 +1259,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc (builder.TryGetCheckResultsBeforeFileInProject fileName).IsSome member builder.GetCheckResultsBeforeSlotInProject slotOfFile = - async { + async2 { let cache = TimeStampCache defaultTimeStamp do! checkFileTimeStamps cache let! result = evalUpToTargetSlot currentState (slotOfFile - 1) @@ -1269,9 +1269,10 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc return PartialCheckResults(boundModel, timestamp, projectTimeStamp) | None -> return! failwith "Expected results to be ready. (GetCheckResultsBeforeSlotInProject)." } + |> Async2.toAsync member builder.GetFullCheckResultsBeforeSlotInProject slotOfFile = - async { + async2 { let cache = TimeStampCache defaultTimeStamp do! checkFileTimeStamps cache let! result = evalUpToTargetSlot currentState (slotOfFile - 1) @@ -1282,6 +1283,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc return PartialCheckResults(boundModel, timestamp, projectTimeStamp) | None -> return! failwith "Expected results to be ready. (GetFullCheckResultsBeforeSlotInProject)." } + |> Async2.toAsync member builder.GetCheckResultsBeforeFileInProject fileName = let slotOfFile = builder.GetSlotOfFileName fileName @@ -1296,17 +1298,18 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc builder.GetFullCheckResultsBeforeSlotInProject slotOfFile member builder.GetFullCheckResultsAfterFileInProject fileName = - async { + async2 { let slotOfFile = builder.GetSlotOfFileName fileName + 1 let! result = builder.GetFullCheckResultsBeforeSlotInProject(slotOfFile) return result } + |> Async2.toAsync member builder.GetCheckResultsAfterLastFileInProject () = builder.GetCheckResultsBeforeSlotInProject(builder.GetSlotsCount()) member builder.GetCheckResultsAndImplementationsForProject() = - async { + async2 { let cache = TimeStampCache(defaultTimeStamp) do! checkFileTimeStamps cache let! result = currentState.finalizedBoundModel.GetOrComputeValue() @@ -1316,14 +1319,16 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc let projectTimeStamp = builder.GetLogicalTimeStampForProject(cache) return PartialCheckResults (boundModel, timestamp, projectTimeStamp), ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt } + |> Async2.toAsync member builder.GetFullCheckResultsAndImplementationsForProject() = - async { + async2 { let! result = builder.GetCheckResultsAndImplementationsForProject() let results, _, _, _ = result let! _ = results.GetOrComputeTcInfoWithExtras() // Make sure we forcefully evaluate the info return result } + |> Async2.toAsync member builder.GetLogicalTimeStampForFileInProject(filename: string) = let slot = builder.GetSlotOfFileName(filename) @@ -1363,18 +1368,18 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc let slotOfFile = builder.GetSlotOfFileName fileName let syntaxTree = currentState.slots[slotOfFile].SyntaxTree syntaxTree.ParseNode.GetOrComputeValue() - |> Async.RunSynchronously + |> Async2.runWithoutCancellation member builder.NotifyFileChanged(fileName, timeStamp) = - async { + async2 { let slotOfFile = builder.GetSlotOfFileName fileName let cache = TimeStampCache defaultTimeStamp - let! ct = Async.CancellationToken do! setCurrentState { currentState with slots = currentState.slots |> List.updateAt slotOfFile (currentState.slots[slotOfFile].Notify timeStamp) } - cache ct + cache } + |> Async2.toAsync member _.SourceFiles = fileNames |> Seq.map (fun f -> f.Source.FilePath) |> List.ofSeq @@ -1407,14 +1412,14 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc let useSimpleResolutionSwitch = "--simpleresolution" - async { + async2 { // Trap and report diagnostics from creation. let delayedLogger = CapturingDiagnosticsLogger("IncrementalBuilderCreation") use _ = new CompilationGlobalsScope(delayedLogger, BuildPhase.Parameter) let! builderOpt = - async { + async2 { try // Create the builder. diff --git a/src/Compiler/Service/IncrementalBuild.fsi b/src/Compiler/Service/IncrementalBuild.fsi index 915f21196a7..f8829eaf50d 100644 --- a/src/Compiler/Service/IncrementalBuild.fsi +++ b/src/Compiler/Service/IncrementalBuild.fsi @@ -20,6 +20,7 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.TcGlobals open FSharp.Compiler.Text open FSharp.Compiler.TypedTree +open Internal.Utilities.Library open Internal.Utilities.Collections type internal FrameworkImportsCacheKey = @@ -295,7 +296,7 @@ type internal IncrementalBuilder = captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * useChangeNotifications: bool -> - Async + Async2 /// Generalized Incremental Builder. This is exposed only for unit testing purposes. module internal IncrementalBuild = diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index 6455d9f0ff3..af832c338a6 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -301,13 +301,11 @@ module UnusedOpens = /// Get the open statements whose contents are not referred to anywhere in the symbol uses. /// Async to allow cancellation. let getUnusedOpens (checkFileResults: FSharpCheckFileResults, getSourceLineStr: int -> string) : Async = - async { - use! _holder = Cancellable.UseToken() - + async2 { if checkFileResults.OpenDeclarations.Length = 0 then return [] else - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct) let symbolUses = filterSymbolUses getSourceLineStr symbolUses let symbolUses = splitSymbolUses symbolUses @@ -318,6 +316,7 @@ module UnusedOpens = else return! filterOpenStatements symbolUses openStatements } + |> Async2.toAsync module SimplifyNames = type SimplifiableRange = { Range: range; RelativeName: string } @@ -326,9 +325,9 @@ module SimplifyNames = (plid |> List.sumBy String.length) + plid.Length let getSimplifiableNames (checkFileResults: FSharpCheckFileResults, getSourceLineStr: int -> string) = - async { + async2 { let result = ResizeArray() - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct) @@ -405,6 +404,7 @@ module SimplifyNames = return (result :> seq<_>) } + |> Async2.toAsync module UnusedDeclarations = let isPotentiallyUnusedDeclaration (symbol: FSharpSymbol) : bool = @@ -464,9 +464,10 @@ module UnusedDeclarations = |> Seq.map (fun (m, _) -> m) let getUnusedDeclarations (checkFileResults: FSharpCheckFileResults, isScriptFile: bool) = - async { - let! ct = Async.CancellationToken + async2 { + let! ct = Async2.CancellationToken let allSymbolUsesInFile = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct) let unusedRanges = getUnusedDeclarationRanges allSymbolUsesInFile isScriptFile return unusedRanges } + |> Async2.toAsync diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index fc049da736a..c3ae3780be6 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -215,17 +215,17 @@ module private TypeCheckingGraphProcessing = /// let processTypeCheckingGraph (graph: Graph) - (work: NodeToTypeCheck -> TcInfo -> Async>) + (work: NodeToTypeCheck -> TcInfo -> Async2>) (emptyState: TcInfo) - : Async<(int * PartialResult) list * TcInfo> = - async { + : Async2<(int * PartialResult) list * TcInfo> = + async2 { let workWrapper (getProcessedNode: NodeToTypeCheck -> ProcessedNode>) (node: NodeInfo) - : Async> = - async { + : Async2> = + async2 { let folder (state: TcInfo) (Finisher(finisher = finisher)) : TcInfo = finisher state |> snd let deps = node.Deps |> Array.except [| node.Item |] |> Array.map getProcessedNode @@ -420,7 +420,7 @@ type internal TransparentCompiler enablePartialTypeChecking, parallelReferenceResolution, captureIdentifiersWhenParsing, - getSource: (string -> Async) option, + getSource, useChangeNotifications, ?cacheSizes ) as self = @@ -577,7 +577,7 @@ type internal TransparentCompiler caches.ScriptClosure.Get( key, - async { + async2 { return ComputeScriptClosureInner fileName @@ -613,7 +613,7 @@ type internal TransparentCompiler caches.FrameworkImports.Get( key, - async { + async2 { use _ = Activity.start "ComputeFrameworkImports" [] let tcConfigP = TcConfigProvider.Constant tcConfig @@ -637,14 +637,14 @@ type internal TransparentCompiler importsInvalidatedByTypeProvider: Event ) = - async { + async2 { let diagnosticsLogger = CompilationDiagnosticLogger("CombineImportedAssembliesTask", tcConfig.diagnosticsOptions) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.Parameter) let! tcImports = - async { + async2 { try let! tcImports = TcImports.BuildNonFrameworkTcImports( @@ -749,7 +749,7 @@ type internal TransparentCompiler then { new IProjectReference with member x.EvaluateRawContents() = - async { + async2 { Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "GetAssemblyData", nm) return! @@ -769,7 +769,7 @@ type internal TransparentCompiler | FSharpReferencedProjectSnapshot.PEReference(getStamp, delayedReader) -> { new IProjectReference with member x.EvaluateRawContents() = - cancellable { + async2 { let! ilReaderOpt = delayedReader.TryGetILModuleReader() match ilReaderOpt with @@ -782,7 +782,6 @@ type internal TransparentCompiler // continue to try to use an on-disk DLL return ProjectAssemblyDataResult.Unavailable false } - |> Cancellable.toAsync member x.TryGetLogicalTimeStamp _ = getStamp () |> Some member x.FileName = delayedReader.OutputFile @@ -791,13 +790,12 @@ type internal TransparentCompiler | FSharpReferencedProjectSnapshot.ILModuleReference(nm, getStamp, getReader) -> { new IProjectReference with member x.EvaluateRawContents() = - cancellable { + async2 { let ilReader = getReader () let ilModuleDef, ilAsmRefs = ilReader.ILModuleDef, ilReader.ILAssemblyRefs let data = RawFSharpAssemblyData(ilModuleDef, ilAsmRefs) :> IRawFSharpAssemblyData return ProjectAssemblyDataResult.Available data } - |> Cancellable.toAsync member x.TryGetLogicalTimeStamp _ = getStamp () |> Some member x.FileName = nm @@ -805,7 +803,7 @@ type internal TransparentCompiler ] let ComputeTcConfigBuilder (projectSnapshot: ProjectSnapshot) = - async { + async2 { let useSimpleResolutionSwitch = "--simpleresolution" let commandLineArgs = projectSnapshot.CommandLineOptions let defaultFSharpBinariesDir = FSharpCheckerResultsSettings.defaultFSharpBinariesDir @@ -830,8 +828,8 @@ type internal TransparentCompiler match lastScriptFile, projectSnapshot.UseScriptResolutionRules with | Some fsxFile, true -> // assuming UseScriptResolutionRules and a single source file means we are doing this for a script - async { - let! source = fsxFile.GetSource() |> Async.AwaitTask + async2 { + let! source = fsxFile.GetSource() let! closure = ComputeScriptClosure @@ -849,7 +847,7 @@ type internal TransparentCompiler return (Some closure) } - | _ -> async { return None } + | _ -> async2 { return None } let sdkDirOverride = match loadClosureOpt with @@ -931,7 +929,7 @@ type internal TransparentCompiler caches.BootstrapInfoStatic.Get( cacheKey, - async { + async2 { use _ = Activity.start "ComputeBootstrapInfoStatic" @@ -1012,7 +1010,7 @@ type internal TransparentCompiler ) let computeBootstrapInfoInner (projectSnapshot: ProjectSnapshot) = - async { + async2 { let! tcConfigB, sourceFiles, loadClosureOpt = ComputeTcConfigBuilder projectSnapshot @@ -1088,7 +1086,7 @@ type internal TransparentCompiler caches.BootstrapInfo.Get( projectSnapshot.NoFileVersionsKey, - async { + async2 { use _ = Activity.start "ComputeBootstrapInfo" @@ -1101,7 +1099,7 @@ type internal TransparentCompiler use _ = new CompilationGlobalsScope(delayedLogger, BuildPhase.Parameter) let! bootstrapInfoOpt = - async { + async2 { try return! computeBootstrapInfoInner projectSnapshot with exn -> @@ -1134,8 +1132,8 @@ type internal TransparentCompiler // TODO: Not sure if we should cache this. For VS probably not. Maybe it can be configurable by FCS user. let LoadSource (file: FSharpFileSnapshot) isExe isLastCompiland = - async { - let! source = file.GetSource() |> Async.AwaitTask + async2 { + let! source = file.GetSource() return FSharpFileSnapshotWithSource( @@ -1148,7 +1146,7 @@ type internal TransparentCompiler } let LoadSources (bootstrapInfo: BootstrapInfo) (projectSnapshot: ProjectSnapshot) = - async { + async2 { let isExe = bootstrapInfo.TcConfig.target.IsExe let! sources = @@ -1178,7 +1176,7 @@ type internal TransparentCompiler caches.ParseFile.Get( key, - async { + async2 { use _ = Activity.start "ComputeParseFile" @@ -1222,7 +1220,7 @@ type internal TransparentCompiler |> Graph.make let computeDependencyGraph (tcConfig: TcConfig) parsedInputs (processGraph: Graph -> Graph) = - async { + async2 { let sourceFiles: FileInProject array = parsedInputs |> Seq.toArray @@ -1357,7 +1355,7 @@ type internal TransparentCompiler caches.TcIntermediate.Get( key, - async { + async2 { let file = projectSnapshot.SourceFiles[index] @@ -1429,7 +1427,7 @@ type internal TransparentCompiler prevTcInfo.tcState, input, true) - |> Cancellable.toAsync + |> Async2.toAsync //fileChecked.Trigger fileName @@ -1451,7 +1449,7 @@ type internal TransparentCompiler let processGraphNode projectSnapshot bootstrapInfo dependencyFiles collectSinks (fileNode: NodeToTypeCheck) tcInfo = // TODO: should this be node? - async { + async2 { match fileNode with | NodeToTypeCheck.PhysicalFile index -> @@ -1534,7 +1532,7 @@ type internal TransparentCompiler } let parseSourceFiles (projectSnapshot: ProjectSnapshotWithSources) tcConfig = - async { + async2 { let! parsedInputs = projectSnapshot.SourceFiles |> Seq.map (ComputeParseFile projectSnapshot tcConfig) @@ -1549,7 +1547,7 @@ type internal TransparentCompiler caches.TcLastFile.Get( projectSnapshot.FileKey fileName, - async { + async2 { let file = projectSnapshot.SourceFiles |> List.last use _ = @@ -1572,7 +1570,7 @@ type internal TransparentCompiler ) let getParseResult (projectSnapshot: ProjectSnapshot) creationDiags file (tcConfig: TcConfig) = - async { + async2 { let! parsedFile = ComputeParseFile projectSnapshot tcConfig file let parseDiagnostics = @@ -1605,9 +1603,7 @@ type internal TransparentCompiler let ComputeParseAndCheckFileInProject (fileName: string) (projectSnapshot: ProjectSnapshot) = caches.ParseAndCheckFileInProject.Get( projectSnapshot.FileKeyWithExtraFileSnapshotVersion fileName, - async { - use! _holder = Cancellable.UseToken() - + async2 { use _ = Activity.start "ComputeParseAndCheckFileInProject" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] @@ -1717,7 +1713,7 @@ type internal TransparentCompiler let ComputeParseAndCheckAllFilesInProject (bootstrapInfo: BootstrapInfo) (projectSnapshot: ProjectSnapshotWithSources) = caches.ParseAndCheckAllFilesInProject.Get( projectSnapshot.FullKey, - async { + async2 { use _ = Activity.start "ComputeParseAndCheckAllFilesInProject" @@ -1767,7 +1763,7 @@ type internal TransparentCompiler let ComputeProjectExtras (bootstrapInfo: BootstrapInfo) (projectSnapshot: ProjectSnapshotWithSources) = caches.ProjectExtras.Get( projectSnapshot.SignatureKey, - async { + async2 { use _ = Activity.start "ComputeProjectExtras" @@ -1866,7 +1862,7 @@ type internal TransparentCompiler let ComputeAssemblyData (projectSnapshot: ProjectSnapshot) fileName = caches.AssemblyData.Get( projectSnapshot.SignatureKey, - async { + async2 { use _ = Activity.start "ComputeAssemblyData" @@ -1874,8 +1870,6 @@ type internal TransparentCompiler Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |> (!!) |] - use! _holder = Cancellable.UseToken() - try let availableOnDiskModifiedTime = @@ -1921,9 +1915,7 @@ type internal TransparentCompiler let ComputeParseAndCheckProject (projectSnapshot: ProjectSnapshot) = caches.ParseAndCheckProject.Get( projectSnapshot.FullKey, - async { - use! _holder = Cancellable.UseToken() - + async2 { match! ComputeBootstrapInfo projectSnapshot with | None, creationDiags -> return FSharpCheckProjectResults(projectSnapshot.ProjectFileName, None, keepAssemblyContents, creationDiags, None) @@ -1995,9 +1987,7 @@ type internal TransparentCompiler ) let tryGetSink (fileName: string) (projectSnapshot: ProjectSnapshot) = - async { - use! _holder = Cancellable.UseToken() - + async2 { match! ComputeBootstrapInfo projectSnapshot with | None, _ -> return None | Some bootstrapInfo, _creationDiags -> @@ -2012,7 +2002,7 @@ type internal TransparentCompiler let ComputeSemanticClassification (fileName: string, projectSnapshot: ProjectSnapshot) = caches.SemanticClassification.Get( projectSnapshot.FileKey fileName, - async { + async2 { use _ = Activity.start "ComputeSemanticClassification" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] @@ -2042,7 +2032,7 @@ type internal TransparentCompiler let ComputeItemKeyStore (fileName: string, projectSnapshot: ProjectSnapshot) = caches.ItemKeyStore.Get( projectSnapshot.FileKey fileName, - async { + async2 { use _ = Activity.start "ComputeItemKeyStore" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] @@ -2077,7 +2067,7 @@ type internal TransparentCompiler ) member _.ParseFile(fileName, projectSnapshot: ProjectSnapshot, _userOpName) = - async { + async2 { //use _ = // Activity.start "ParseFile" [| Activity.Tags.fileName, fileName |> Path.GetFileName |] @@ -2101,10 +2091,10 @@ type internal TransparentCompiler member _.ParseFileWithoutProject (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) - : Async = + : Async2 = let parseFileAsync = - async { - let! ct = Async.CancellationToken + async2 { + let! ct = Async2.CancellationToken let diagnostics, parsedInput, anyErrors = ParseAndCheckFile.parseFile (sourceText, fileName, options, userOpName, false, flatErrors, false, ct) @@ -2163,7 +2153,7 @@ type internal TransparentCompiler member _.FindReferencesInFile(fileName: string, projectSnapshot: ProjectSnapshot, symbol: FSharpSymbol, userOpName: string) = ignore userOpName - async { + async2 { match! ComputeItemKeyStore(fileName, projectSnapshot) with | None -> return Seq.empty | Some itemKeyStore -> return itemKeyStore.FindAll symbol.Item @@ -2192,8 +2182,8 @@ type internal TransparentCompiler sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string - ) : Async = - async { + ) : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) ignore parseResults @@ -2211,8 +2201,8 @@ type internal TransparentCompiler sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string - ) : Async = - async { + ) : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) ignore parseResults @@ -2256,8 +2246,8 @@ type internal TransparentCompiler member this.FindReferencesInFile (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) - : Async> = - async { + : Async2> = + async2 { ignore canInvalidateProject let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2271,8 +2261,8 @@ type internal TransparentCompiler member _.FrameworkImportsCache: FrameworkImportsCache = backgroundCompiler.FrameworkImportsCache - member this.GetAssemblyData(options: FSharpProjectOptions, fileName, userOpName: string) : Async = - async { + member this.GetAssemblyData(options: FSharpProjectOptions, fileName, userOpName: string) : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) return! this.GetAssemblyData(snapshot.ProjectSnapshot, fileName, userOpName) @@ -2280,13 +2270,13 @@ type internal TransparentCompiler member this.GetAssemblyData (projectSnapshot: FSharpProjectSnapshot, fileName, userOpName: string) - : Async = + : Async2 = this.GetAssemblyData(projectSnapshot.ProjectSnapshot, fileName, userOpName) member this.GetBackgroundCheckResultsForFileInProject (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = - async { + : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) match! this.ParseAndCheckFileInProject(fileName, snapshot.ProjectSnapshot, userOpName) with @@ -2296,8 +2286,8 @@ type internal TransparentCompiler member this.GetBackgroundParseResultsForFileInProject (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = - async { + : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) return! this.ParseFile(fileName, snapshot.ProjectSnapshot, userOpName) @@ -2305,8 +2295,8 @@ type internal TransparentCompiler member this.GetCachedCheckFileResult (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) - : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = - async { + : Async2<(FSharpParseFileResults * FSharpCheckFileResults) option> = + async2 { ignore builder let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, 1, sourceText, documentSource) @@ -2330,8 +2320,8 @@ type internal TransparentCompiler assumeDotNetFramework: bool option, optionsStamp: int64 option, userOpName: string - ) : Async = - async { + ) : Async2 = + async2 { let bc = this :> IBackgroundCompiler let! snapshot, diagnostics = @@ -2370,13 +2360,13 @@ type internal TransparentCompiler assumeDotNetFramework: bool option, optionsStamp: int64 option, userOpName: string - ) : Async = + ) : Async2 = use _ = Activity.start "BackgroundCompiler.GetProjectOptionsFromScript" [| Activity.Tags.fileName, fileName; Activity.Tags.userOpName, userOpName |] - async { + async2 { // Use the same default as the background compiler. let useFsiAuxLib = defaultArg useFsiAuxLib true let useSdkRefs = defaultArg useSdkRefs true @@ -2437,7 +2427,7 @@ type internal TransparentCompiler optionsStamp // Populate the cache. - let! _ = caches.ScriptClosure.Get(loadClosureKey, async { return loadClosure }) + let! _ = caches.ScriptClosure.Get(loadClosureKey, async2 { return loadClosure }) let sourceFiles = loadClosure.SourceFiles @@ -2484,15 +2474,15 @@ type internal TransparentCompiler } member this.GetSemanticClassificationForFile(fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) = - async { + async2 { ignore userOpName return! ComputeSemanticClassification(fileName, snapshot.ProjectSnapshot) } member this.GetSemanticClassificationForFile (fileName: string, options: FSharpProjectOptions, userOpName: string) - : Async = - async { + : Async2 = + async2 { ignore userOpName let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2506,16 +2496,16 @@ type internal TransparentCompiler member this.InvalidateConfiguration(projectSnapshot: FSharpProjectSnapshot, _userOpName: string) : unit = this.Caches.Clear(Set.singleton projectSnapshot.Identifier) - member this.NotifyFileChanged(fileName: string, options: FSharpProjectOptions, userOpName: string) : Async = + member this.NotifyFileChanged(fileName: string, options: FSharpProjectOptions, userOpName: string) : Async2 = backgroundCompiler.NotifyFileChanged(fileName, options, userOpName) - member this.NotifyProjectCleaned(options: FSharpProjectOptions, userOpName: string) : Async = + member this.NotifyProjectCleaned(options: FSharpProjectOptions, userOpName: string) : Async2 = backgroundCompiler.NotifyProjectCleaned(options, userOpName) member this.ParseAndCheckFileInProject (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) - : Async = - async { + : Async2 = + async2 { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) return! this.ParseAndCheckFileInProject(fileName, snapshot.ProjectSnapshot, userOpName) @@ -2524,8 +2514,8 @@ type internal TransparentCompiler member this.ParseAndCheckFileInProject(fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) = this.ParseAndCheckFileInProject(fileName, projectSnapshot.ProjectSnapshot, userOpName) - member this.ParseAndCheckProject(options: FSharpProjectOptions, userOpName: string) : Async = - async { + member this.ParseAndCheckProject(options: FSharpProjectOptions, userOpName: string) : Async2 = + async2 { ignore userOpName let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2533,8 +2523,8 @@ type internal TransparentCompiler return! ComputeParseAndCheckProject snapshot.ProjectSnapshot } - member this.ParseAndCheckProject(projectSnapshot: FSharpProjectSnapshot, userOpName: string) : Async = - async { + member this.ParseAndCheckProject(projectSnapshot: FSharpProjectSnapshot, userOpName: string) : Async2 = + async2 { ignore userOpName return! ComputeParseAndCheckProject projectSnapshot.ProjectSnapshot } @@ -2544,7 +2534,7 @@ type internal TransparentCompiler member this.ParseFile (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) - : Async = + : Async2 = this.ParseFileWithoutProject(fileName, sourceText, options, cache, flatErrors, userOpName) member this.TryGetRecentCheckResultsForFile diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 2eb1786dc74..e56b2014b3a 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -21,6 +21,7 @@ open FSharp.Compiler.TypedTree open FSharp.Compiler.CheckDeclarations open FSharp.Compiler.EditorServices open FSharp.Compiler.CodeAnalysis.ProjectSnapshot +open Internal.Utilities.Library /// Accumulated results of type checking. The minimum amount of state in order to continue type-checking following files. [] @@ -198,19 +199,19 @@ type internal TransparentCompiler = member FindReferencesInFile: fileName: string * projectSnapshot: ProjectSnapshot.ProjectSnapshot * symbol: FSharpSymbol * userOpName: string -> - Async + Async2 member GetAssemblyData: projectSnapshot: ProjectSnapshot.ProjectSnapshot * fileName: string * _userOpName: string -> - Async + Async2 member ParseAndCheckFileInProject: fileName: string * projectSnapshot: ProjectSnapshot.ProjectSnapshot * userOpName: string -> - Async + Async2 member ParseFile: fileName: string * projectSnapshot: ProjectSnapshot.ProjectSnapshot * _userOpName: 'a -> - Async + Async2 member SetCacheSize: cacheSize: CacheSizes -> unit member SetCacheSizeFactor: sizeFactor: int -> unit diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 75d6c137087..3b55bd912b0 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -255,11 +255,11 @@ type FSharpChecker let hash = sourceText.GetHashCode() |> int64 - async { + async2 { match braceMatchCache.TryGet(AnyCallerThread, (fileName, hash, options)) with | Some res -> return res | None -> - let! ct = Async.CancellationToken + let! ct = Async2.CancellationToken let res = ParseAndCheckFile.matchBraces (sourceText, fileName, options, userOpName, suggestNamesForErrors, ct) @@ -267,6 +267,7 @@ type FSharpChecker braceMatchCache.Set(AnyCallerThread, (fileName, hash, options), res) return res } + |> Async2.toAsync member ic.MatchBraces(fileName, source: string, options: FSharpProjectOptions, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" @@ -281,12 +282,15 @@ type FSharpChecker member _.ParseFile(fileName, sourceText, options, ?cache, ?userOpName: string) = let cache = defaultArg cache true let userOpName = defaultArg userOpName "Unknown" + backgroundCompiler.ParseFile(fileName, sourceText, options, cache, false, userOpName) + |> Async2.toAsync member _.ParseFile(fileName, projectSnapshot, ?userOpName) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseFile(fileName, projectSnapshot, userOpName) + |> Async2.toAsync member ic.ParseFileInProject(fileName, source: string, options, ?cache: bool, ?userOpName: string) = let parsingOptions, _ = ic.GetParsingOptionsFromProjectOptions(options) @@ -296,11 +300,13 @@ type FSharpChecker let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) + |> Async2.toAsync member _.GetBackgroundCheckResultsForFileInProject(fileName, options, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) + |> Async2.toAsync /// Try to get recent approximate type check results for a file. member _.TryGetRecentCheckResultsForFile(fileName: string, options: FSharpProjectOptions, ?sourceText, ?userOpName: string) = @@ -361,12 +367,13 @@ type FSharpChecker /// This function is called when a project has been cleaned, and thus type providers should be refreshed. member _.NotifyProjectCleaned(options: FSharpProjectOptions, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" - backgroundCompiler.NotifyProjectCleaned(options, userOpName) + backgroundCompiler.NotifyProjectCleaned(options, userOpName) |> Async2.toAsync member _.NotifyFileChanged(fileName: string, options: FSharpProjectOptions, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.NotifyFileChanged(fileName, options, userOpName) + |> Async2.toAsync /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. @@ -383,6 +390,7 @@ type FSharpChecker options, userOpName ) + |> Async2.toAsync /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. @@ -398,6 +406,7 @@ type FSharpChecker let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.CheckFileInProject(parseResults, fileName, fileVersion, sourceText, options, userOpName) + |> Async2.toAsync /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. @@ -407,21 +416,24 @@ type FSharpChecker let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) + |> Async2.toAsync member _.ParseAndCheckFileInProject(fileName: string, projectSnapshot: FSharpProjectSnapshot, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckFileInProject(fileName, projectSnapshot, userOpName) + |> Async2.toAsync member _.ParseAndCheckProject(options: FSharpProjectOptions, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" - backgroundCompiler.ParseAndCheckProject(options, userOpName) + backgroundCompiler.ParseAndCheckProject(options, userOpName) |> Async2.toAsync member _.ParseAndCheckProject(projectSnapshot: FSharpProjectSnapshot, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckProject(projectSnapshot, userOpName) + |> Async2.toAsync member _.FindBackgroundReferencesInFile (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, ?canInvalidateProject: bool, ?fastCheck: bool, ?userOpName: string) @@ -429,7 +441,7 @@ type FSharpChecker let canInvalidateProject = defaultArg canInvalidateProject true let userOpName = defaultArg userOpName "Unknown" - async { + async2 { if fastCheck <> Some true || not captureIdentifiersWhenParsing then return! backgroundCompiler.FindReferencesInFile(fileName, options, symbol, canInvalidateProject, userOpName) else @@ -443,11 +455,12 @@ type FSharpChecker else return Seq.empty } + |> Async2.toAsync member _.FindBackgroundReferencesInFile(fileName: string, projectSnapshot: FSharpProjectSnapshot, symbol: FSharpSymbol, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" - async { + async2 { let! parseResults = backgroundCompiler.ParseFile(fileName, projectSnapshot, userOpName) if @@ -458,16 +471,21 @@ type FSharpChecker else return Seq.empty } + |> Async2.toAsync - member _.GetBackgroundSemanticClassificationForFile(fileName: string, options: FSharpProjectOptions, ?userOpName) = + member _.GetBackgroundSemanticClassificationForFile + (fileName: string, options: FSharpProjectOptions, ?userOpName) + : Async = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.GetSemanticClassificationForFile(fileName, options, userOpName) + |> Async2.toAsync member _.GetBackgroundSemanticClassificationForFile(fileName: string, snapshot: FSharpProjectSnapshot, ?userOpName) = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.GetSemanticClassificationForFile(fileName, snapshot, userOpName) + |> Async2.toAsync /// For a given script file, get the ProjectOptions implied by the #load closure member _.GetProjectOptionsFromScript @@ -501,6 +519,7 @@ type FSharpChecker optionsStamp, userOpName ) + |> Async2.toAsync /// For a given script file, get the ProjectSnapshot implied by the #load closure member _.GetProjectSnapshotFromScript @@ -537,6 +556,7 @@ type FSharpChecker optionsStamp, userOpName ) + |> Async2.toAsync member _.GetProjectOptionsFromCommandLineArgs(projectFileName, argv, ?loadedTimeStamp, ?isInteractive, ?isEditing) = let isEditing = defaultArg isEditing false diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs new file mode 100644 index 00000000000..1c89f8854ac --- /dev/null +++ b/src/Compiler/Utilities/Async2.fs @@ -0,0 +1,606 @@ +namespace Internal.Utilities.Library + +open System +open System.Threading +open System.Threading.Tasks +open System.Runtime.CompilerServices +open System.Runtime.ExceptionServices +open FSharp.Core.CompilerServices.StateMachineHelpers +open Microsoft.FSharp.Core.CompilerServices + +#nowarn 3513 + +type IAsync2Invocation<'t> = + abstract Task: Task<'t> + abstract GetAwaiter: unit -> TaskAwaiter<'t> + +and Async2<'t> = + abstract Start: CancellationToken -> IAsync2Invocation<'t> + abstract Await: CancellationToken -> IAsync2Invocation<'t> + abstract TailCall: CancellationToken * TaskCompletionSource<'t> -> unit + +module Async2Implementation = + + /// A structure that looks like an Awaiter + type Awaiter<'Awaiter, 'TResult + when 'Awaiter :> ICriticalNotifyCompletion + and 'Awaiter: (member get_IsCompleted: unit -> bool) + and 'Awaiter: (member GetResult: unit -> 'TResult)> = 'Awaiter + + type Awaitable<'Awaitable, 'Awaiter, 'TResult when 'Awaitable: (member GetAwaiter: unit -> Awaiter<'Awaiter, 'TResult>)> = 'Awaitable + + module Awaiter = + let inline isCompleted (awaiter: Awaiter<_, _>) = awaiter.get_IsCompleted () + + let inline getResult (awaiter: Awaiter<_, _>) = awaiter.GetResult() + + let inline onCompleted (awaiter: Awaiter<_, _>) continuation = awaiter.OnCompleted continuation + + let inline unsafeOnCompleted (awaiter: Awaiter<_, _>) continuation = awaiter.UnsafeOnCompleted continuation + + module Awaitable = + let inline getAwaiter (awaitable: Awaitable<_, _, _>) = awaitable.GetAwaiter() + + type DynamicState = + | Running + | SetResult + | SetException of ExceptionDispatchInfo + | Awaiting of ICriticalNotifyCompletion + | Bounce of DynamicState + | Immediate of DynamicState + + type Trampoline private () = + + static let holder = new ThreadLocal<_>(fun () -> Trampoline()) + + let mutable depth = 0 + + [] + let MaxDepth = 50 + + let mutable pending: Action voption = ValueNone + let mutable running = false + + let start () = + try + running <- true + + while pending.IsSome do + let next = pending.Value + pending <- ValueNone + next.Invoke() + finally + running <- false + + let set action = + pending <- ValueSome action + + if not running then + start () + + interface ICriticalNotifyCompletion with + member _.OnCompleted continuation = set continuation + member _.UnsafeOnCompleted continuation = set continuation + + member this.Ref: ICriticalNotifyCompletion ref = ref this + + static member Current = holder.Value + + member _.ShouldBounce = + // We must check pending here because of MergeSources. + not running + || pending.IsNone + && (depth <- depth + 1 + depth % MaxDepth = 0) + + module ExceptionCache = + let store = ConditionalWeakTable() + + let inline CaptureOrRetrieve (exn: exn) = + match store.TryGetValue exn with + | true, edi when edi.SourceException = exn -> edi + | _ -> + let edi = ExceptionDispatchInfo.Capture exn + + try + store.Add(exn, edi) + with _ -> + () + + edi + + let inline Throw (exn: exn) = + let edi = CaptureOrRetrieve exn + edi.Throw() + Unchecked.defaultof<_> + + let inline GetResultOrThrow awaiter = + try + Awaiter.getResult awaiter + with exn -> + Throw exn + + [] + type Async2Data<'t> = + [] + val mutable Result: 't + + [] + val mutable MethodBuilder: AsyncTaskMethodBuilder<'t> + + [] + val mutable TailCallSource: TaskCompletionSource<'t> option + + [] + val mutable Awaited: bool + + [] + val mutable CancellationToken: CancellationToken + + type Async2StateMachine<'TOverall> = ResumableStateMachine> + type IAsync2StateMachine<'TOverall> = IResumableStateMachine> + type Async2ResumptionFunc<'TOverall> = ResumptionFunc> + type Async2ResumptionDynamicInfo<'TOverall> = ResumptionDynamicInfo> + + type Async2Code<'TOverall, 'T> = ResumableCode, 'T> + + [] + type Async2<'t, 'm when 'm :> IAsyncStateMachine and 'm :> IAsync2StateMachine<'t>> = + [] + val mutable StateMachine: 'm + + member ts.Start(ct, awaited, ?tailCallSource) = + let mutable copy = ts + let mutable data = Async2Data() + data.CancellationToken <- ct + data.Awaited <- awaited + data.TailCallSource <- tailCallSource + data.MethodBuilder <- AsyncTaskMethodBuilder<'t>.Create() + copy.StateMachine.Data <- data + copy.StateMachine.Data.MethodBuilder.Start(©.StateMachine) + copy :> IAsync2Invocation<'t> + + interface IAsync2Invocation<'t> with + member ts.Task = ts.StateMachine.Data.MethodBuilder.Task + + member ts.GetAwaiter() = + ts.StateMachine.Data.MethodBuilder.Task.GetAwaiter() + + interface Async2<'t> with + member ts.Start ct = ts.Start(ct, false) + + member ts.Await ct = ts.Start(ct, true) + + member ts.TailCall(ct, tc) = ts.Start(ct, true, tc) |> ignore + + type Async2Dynamic<'t, 'm when 'm :> IAsyncStateMachine and 'm :> IAsync2StateMachine<'t>>(getCopy: bool -> 'm) = + member ts.GetCopy(awaited) = + Async2(StateMachine = getCopy awaited) :> Async2<_> + + interface Async2<'t> with + member ts.Start ct = ts.GetCopy(false).Start(ct) + + member ts.Await ct = ts.GetCopy(true).Await(ct) + + member ts.TailCall(ct, tc) = ts.GetCopy(true).TailCall(ct, tc) + + [] + module Async2Code = + let inline filterCancellation ([] catch: exn -> Async2Code<_, _>) (exn: exn) = + Async2Code(fun sm -> + match exn with + | :? OperationCanceledException as oce when + sm.Data.CancellationToken.IsCancellationRequested + || oce.CancellationToken = sm.Data.CancellationToken + -> + raise exn + | _ -> (catch exn).Invoke(&sm)) + + let inline throwIfCancellationRequested (code: Async2Code<_, _>) = + Async2Code(fun sm -> + sm.Data.CancellationToken.ThrowIfCancellationRequested() + code.Invoke(&sm)) + + let inline maybeBounce () = + Async2Code(fun sm -> + if sm.Data.Awaited && Trampoline.Current.ShouldBounce then + let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) + + if not __stack_yield_fin then + sm.Data.MethodBuilder.AwaitOnCompleted(Trampoline.Current.Ref, &sm) + + __stack_yield_fin + else + true) + + let inline bindDynamic (sm: byref>, awaiter, [] continuation: _ -> Async2Code<_, _>) = + if Awaiter.isCompleted awaiter then + (Awaiter.getResult awaiter |> continuation).Invoke(&sm) + else + let resumptionFunc = + Async2ResumptionFunc(fun sm -> + let result = ExceptionCache.GetResultOrThrow awaiter + (continuation result).Invoke(&sm)) + + sm.ResumptionDynamicInfo.ResumptionFunc <- resumptionFunc + sm.ResumptionDynamicInfo.ResumptionData <- Awaiting awaiter + false + + let inline bindAwaiter (awaiter, [] continuation: 'U -> Async2Code<'Data, 'T>) : Async2Code<'Data, 'T> = + Async2Code(fun sm -> + if __useResumableCode then + if Awaiter.isCompleted awaiter then + continuation(ExceptionCache.GetResultOrThrow awaiter).Invoke(&sm) + else + let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) + + if __stack_yield_fin then + continuation(ExceptionCache.GetResultOrThrow awaiter).Invoke(&sm) + else + let mutable __stack_awaiter = awaiter + sm.Data.MethodBuilder.AwaitUnsafeOnCompleted(&__stack_awaiter, &sm) + false + else + bindDynamic (&sm, awaiter, continuation)) + + let inline bindAwaitable (awaitable, [] continuation) = + bindAwaiter (Awaitable.getAwaiter awaitable, continuation) + + let inline bindCancellable + ([] cancellable, [] continuation: 'U -> Async2Code<'Data, 'T>) + : Async2Code<'Data, 'T> = + Async2Code<'Data, 'T>(fun sm -> bindAwaitable(cancellable sm.Data.CancellationToken, continuation).Invoke(&sm)) + + let inline bindCancellableAwaiter ([] getAwaiter, [] continuation) = + Async2Code<'Data, 'T>(fun sm -> bindAwaiter(getAwaiter sm.Data.CancellationToken, continuation).Invoke(&sm)) + + type Async2Builder() = + + member inline _.Delay(generator: unit -> Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = + ResumableCode.Delay(fun () -> generator () |> throwIfCancellationRequested) + + [] + member inline _.Zero() : Async2Code<'TOverall, unit> = ResumableCode.Zero() + + member inline _.Return(value: 'T) = + Async2Code(fun sm -> + sm.Data.Result <- value + true) + + member inline _.Combine(code1: Async2Code<'TOverall, unit>, code2: Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = + ResumableCode.Combine(code1, code2) + + member inline _.While([] condition: unit -> bool, body: Async2Code<'TOverall, unit>) : Async2Code<'TOverall, unit> = + ResumableCode.While(condition, throwIfCancellationRequested body) + + member inline _.TryWith + (body: Async2Code<'TOverall, 'T>, [] catch: exn -> Async2Code<'TOverall, 'T>) + : Async2Code<'TOverall, 'T> = + ResumableCode.TryWith(body, filterCancellation catch) + + member inline _.TryFinally + (body: Async2Code<'TOverall, 'T>, [] compensation: unit -> unit) + : Async2Code<'TOverall, 'T> = + ResumableCode.TryFinally( + body, + ResumableCode<_, _>(fun _sm -> + compensation () + true) + ) + + member inline _.Using<'Resource, 'TOverall, 'T when 'Resource :> IDisposable | null> + (resource: 'Resource, body: 'Resource -> Async2Code<'TOverall, 'T>) + : Async2Code<'TOverall, 'T> = + ResumableCode.Using(resource, body) + + member inline _.For(sequence: seq<'T>, [] body: 'T -> Async2Code<'TOverall, unit>) : Async2Code<'TOverall, unit> = + ResumableCode.For(sequence, fun x -> body x |> throwIfCancellationRequested) + + static member inline RunDynamic(code: Async2Code<'T, 'T>) : Async2<'T> = + let initialResumptionFunc = Async2ResumptionFunc<'T>(fun sm -> code.Invoke &sm) + + let maybeBounce state = + if Trampoline.Current.ShouldBounce then + Bounce state + else + Immediate state + + let resumptionInfo awaited = + let initialState = + if awaited then + maybeBounce Running + else + Immediate Running + + { new Async2ResumptionDynamicInfo<'T>(initialResumptionFunc, ResumptionData = initialState) with + member info.MoveNext(sm) = + + let getCurrent () = + nonNull info.ResumptionData :?> DynamicState + + let setState state = info.ResumptionData <- state + + match getCurrent () with + | Immediate state -> + setState state + info.MoveNext &sm + | Running -> + let mutable keepGoing = true + + try + if info.ResumptionFunc.Invoke(&sm) then + setState (maybeBounce SetResult) + else + keepGoing <- getCurrent () |> _.IsAwaiting + with exn -> + setState (maybeBounce <| SetException(ExceptionCache.CaptureOrRetrieve exn)) + + if keepGoing then + info.MoveNext &sm + | Awaiting awaiter -> + setState Running + let mutable awaiter = awaiter + sm.Data.MethodBuilder.AwaitUnsafeOnCompleted(&awaiter, &sm) + | Bounce next -> + setState next + sm.Data.MethodBuilder.AwaitOnCompleted(Trampoline.Current.Ref, &sm) + | SetResult -> + match sm.Data.TailCallSource with + | Some tcs -> tcs.SetResult sm.Data.Result + | _ -> sm.Data.MethodBuilder.SetResult sm.Data.Result + | SetException edi -> + match sm.Data.TailCallSource with + | Some tcs -> tcs.TrySetException(edi.SourceException) |> ignore + | _ -> sm.Data.MethodBuilder.SetException(edi.SourceException) + + member _.SetStateMachine(sm, state) = + sm.Data.MethodBuilder.SetStateMachine(state) + } + + Async2Dynamic<_, _>(fun awaited -> Async2StateMachine(ResumptionDynamicInfo = resumptionInfo awaited)) + + member inline _.Run(code: Async2Code<'T, 'T>) : Async2<'T> = + if __useResumableCode then + __stateMachine, _> + + (MoveNextMethodImpl<_>(fun sm -> + __resumeAt sm.ResumptionPoint + + let mutable error = ValueNone + + let __stack_go1 = maybeBounce().Invoke(&sm) + + if __stack_go1 then + try + let __stack_code_fin = code.Invoke(&sm) + + if __stack_code_fin then + let __stack_go2 = maybeBounce().Invoke(&sm) + + if __stack_go2 then + match sm.Data.TailCallSource with + | Some tcs -> tcs.SetResult sm.Data.Result + | _ -> sm.Data.MethodBuilder.SetResult(sm.Data.Result) + with exn -> + error <- ValueSome(ExceptionCache.CaptureOrRetrieve exn) + + if error.IsSome then + let __stack_go2 = maybeBounce().Invoke(&sm) + + if __stack_go2 then + match sm.Data.TailCallSource with + | Some tcs -> tcs.SetException(error.Value.SourceException) + | _ -> sm.Data.MethodBuilder.SetException(error.Value.SourceException))) + + (SetStateMachineMethodImpl<_>(fun sm state -> sm.Data.MethodBuilder.SetStateMachine state)) + + (AfterCode<_, _>(fun sm -> Async2<_, _>(StateMachine = sm) :> Async2<'T>)) + else + Async2Builder.RunDynamic(code) + +open Async2Implementation + +[] +module LowPriority = + type Async2Builder with + [] + member inline this.Bind(awaitable, [] continuation) = + bindAwaitable (awaitable, continuation) + + [] + member inline this.ReturnFrom(awaitable) = this.Bind(awaitable, this.Return) + + [] + member inline this.ReturnFromFinal(awaitable) = this.ReturnFrom(awaitable) + +[] +module MediumPriority = + type Async2Builder with + member inline this.Bind(expr: Async<_>, [] continuation) = + bindCancellableAwaiter ((fun ct -> Async.StartAsTask(expr, cancellationToken = ct).GetAwaiter()), continuation) + + member inline this.Bind(task: Task, [] continuation) = + bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) + + member inline this.Bind(task: Task<_>, [] continuation) = + bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) + + member inline this.ReturnFrom(task: Task) = this.Bind(task, this.Return) + member inline this.ReturnFrom(task: Task<_>) = this.Bind(task, this.Return) + member inline this.ReturnFrom(expr: Async<_>) = this.Bind(expr, this.Return) + member inline this.ReturnFromFinal(task: Task) = this.ReturnFrom(task) + member inline this.ReturnFromFinal(task: Task<_>) = this.ReturnFrom(task) + member inline this.ReturnFromFinal(expr: Async<_>) = this.ReturnFrom(expr) + +[] +module HighPriority = + + // When Async2 is bound, we know that it is not yet started (cold). This allows for some optimizations. + type Async2Builder with + member inline this.Bind(code: Async2<'U>, [] continuation) : Async2Code<'Data, 'T> = + bindCancellable (code.Await, continuation) + + member inline this.ReturnFrom(code: Async2<'T>) : Async2Code<'T, 'T> = this.Bind(code, this.Return) + + member inline this.ReturnFromFinal(code: Async2<'T>) = + Async2Code(fun sm -> + match sm.Data.TailCallSource with + | None -> + // This is the start of a tail call chain. we need to return here when the entire chain is done. + let __stack_tcs = TaskCompletionSource<_>() + code.TailCall(sm.Data.CancellationToken, __stack_tcs) + this.Bind(__stack_tcs.Task, this.Return).Invoke(&sm) + | Some tcs -> + // We are already in a tail call chain. + code.TailCall(sm.Data.CancellationToken, tcs) + false // Return false to abandon this state machine and continue on the next one. + ) + +[] +module Async2AutoOpens = + + let async2 = Async2Builder() + +module Async2 = + + let CheckAndThrowToken = AsyncLocal() + + let startInThreadPool ct (code: Async2<_>) = + Task.Run<'t>(fun () -> + CheckAndThrowToken.Value <- ct + code.Start ct |> _.Task) + + let inline startImmediate ct (code: Async2<_>) = + let oldCt = CheckAndThrowToken.Value + + try + CheckAndThrowToken.Value <- ct + code.Start ct |> _.Task + + finally + CheckAndThrowToken.Value <- oldCt + + let run ct (code: Async2<'t>) = + startInThreadPool ct code |> _.GetAwaiter().GetResult() + + let runWithoutCancellation code = run CancellationToken.None code + + let startAsTaskWithoutCancellation code = + startInThreadPool CancellationToken.None code + + let toAsync (code: Async2<'t>) = + async { + let! ct = Async.CancellationToken + let task = startInThreadPool ct code + return! Async.AwaitTask task + } + + let fromValue (value: 't) : Async2<'t> = async2 { return value } + + let CancellationToken = + async2.Run( + Async2Code(fun sm -> + sm.Data.Result <- sm.Data.CancellationToken + true) + ) + +type Async2 = + static member Ignore(computation: Async2<_>) : Async2 = + async2 { + let! _ = computation + return () + } + + static member Start(computation: Async2<_>, ?cancellationToken: CancellationToken) : unit = + let ct = defaultArg cancellationToken CancellationToken.None + Async2.startInThreadPool ct computation |> ignore + + static member StartAsTask(computation: Async2<_>, ?cancellationToken: CancellationToken) : Task<_> = + let ct = defaultArg cancellationToken CancellationToken.None + Async2.startImmediate ct computation + + static member RunImmediate(computation: Async2<'T>, ?cancellationToken: CancellationToken) : 'T = + let ct = defaultArg cancellationToken CancellationToken.None + Async2.startImmediate ct computation |> _.GetAwaiter().GetResult() + + static member RunSynchronously(computation: Async2<'T>, ?cancellationToken: CancellationToken) : 'T = + let ct = defaultArg cancellationToken CancellationToken.None + Async2.run ct computation + + static member Parallel(computations: Async2<_> seq) = + async2 { + let! ct = Async2.CancellationToken + use lcts = CancellationTokenSource.CreateLinkedTokenSource ct + try + let tasks = computations |> Seq.map (Async2.startInThreadPool lcts.Token) + return! Task.WhenAll tasks + with exn -> + lcts.Cancel() + return raise exn + } + + static member Sequential(computations: Async2<_> seq) = + async2 { + let results = ResizeArray() + + for c in computations do + let! r = c + results.Add r + + return results.ToArray() + } + + static member Catch(computation: Async2<'T>) : Async2> = + async2 { + try + let! res = computation + return Choice1Of2 res + with exn -> + return Choice2Of2 exn + } + + static member TryCancelled(computation: Async2<'T>, compensation) = + async2 { + let! ct = Async2.CancellationToken + let invocation = computation.Start ct + + try + return! invocation + finally + if ct.IsCancellationRequested && invocation.Task.IsCanceled then + compensation () + } + + static member StartChild(computation: Async2<'T>) : Async2> = + async2 { + let! ct = Async2.CancellationToken + return async2 { return! computation |> Async2.startInThreadPool ct } + } + + static member StartChildAsTask(computation: Async2<'T>) : Async2> = + async2 { + let! ct = Async2.CancellationToken + let task = computation |> Async2.startInThreadPool ct + return task + } + + static member AwaitWaitHandle(waitHandle: WaitHandle) : Async2 = + async2 { + let! ct = Async2.CancellationToken + + let tcs = + TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously) + + use _ = ct.Register(fun () -> tcs.TrySetCanceled() |> ignore) + + let callback = + WaitOrTimerCallback(fun _ timedOut -> tcs.TrySetResult(not timedOut) |> ignore) + + let handle = + ThreadPool.RegisterWaitForSingleObject(waitHandle, callback, null, -1, true) + + try + return! tcs.Task + finally + handle.Unregister(waitHandle) |> ignore + } diff --git a/src/Compiler/Utilities/Cancellable.fs b/src/Compiler/Utilities/Cancellable.fs index bae9c6f8299..fa70be53ebd 100644 --- a/src/Compiler/Utilities/Cancellable.fs +++ b/src/Compiler/Utilities/Cancellable.fs @@ -1,226 +1,10 @@ namespace FSharp.Compiler -open System -open System.Threading - -// This code provides two methods for handling cancellation in synchronous code: -// 1. Explicitly, by calling Cancellable.CheckAndThrow(). -// 2. Implicitly, by wrapping the code in a cancellable computation. -// The cancellable computation propagates the CancellationToken and checks for cancellation implicitly. -// When it is impractical to use the cancellable computation, such as in deeply nested functions, Cancellable.CheckAndThrow() can be used. -// It checks a CancellationToken local to the current async execution context, held in AsyncLocal. -// Before calling Cancellable.CheckAndThrow(), this token must be set. -// The token is guaranteed to be set during execution of cancellable computation. -// Otherwise, it can be passed explicitly from the ambient async computation using Cancellable.UseToken(). +open Internal.Utilities.Library [] type Cancellable = - static let tokenHolder = AsyncLocal() - - static let guard = - String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("DISABLE_CHECKANDTHROW_ASSERT")) - - static let ensureToken msg = - tokenHolder.Value - |> ValueOption.defaultWith (fun () -> if guard then failwith msg else CancellationToken.None) - - static member HasCancellationToken = tokenHolder.Value.IsSome - - static member Token = ensureToken "Token not available outside of Cancellable computation." - - static member UseToken() = - async { - let! ct = Async.CancellationToken - return Cancellable.UsingToken ct - } - - static member UsingToken(ct) = - let oldCt = tokenHolder.Value - tokenHolder.Value <- ValueSome ct - - { new IDisposable with - member _.Dispose() = tokenHolder.Value <- oldCt - } - static member CheckAndThrow() = - let token = ensureToken "CheckAndThrow invoked outside of Cancellable computation." - token.ThrowIfCancellationRequested() - - static member TryCheckAndThrow() = - match tokenHolder.Value with - | ValueNone -> () - | ValueSome token -> token.ThrowIfCancellationRequested() - -namespace Internal.Utilities.Library - -open System -open System.Threading -open FSharp.Compiler - -open FSharp.Core.CompilerServices.StateMachineHelpers - -[] -type ValueOrCancelled<'TResult> = - | Value of result: 'TResult - | Cancelled of ``exception``: OperationCanceledException - -[] -type Cancellable<'T> = Cancellable of (CancellationToken -> ValueOrCancelled<'T>) - -module Cancellable = - - let inline run (ct: CancellationToken) (Cancellable oper) = - if ct.IsCancellationRequested then - ValueOrCancelled.Cancelled(OperationCanceledException ct) - else - try - oper ct - with - | :? OperationCanceledException as e when ct.IsCancellationRequested -> ValueOrCancelled.Cancelled e - | :? OperationCanceledException as e -> InvalidOperationException("Wrong cancellation token", e) |> raise - - let fold f acc seq = - Cancellable(fun ct -> - let mutable acc = ValueOrCancelled.Value acc - - for x in seq do - match acc with - | ValueOrCancelled.Value accv -> acc <- run ct (f accv x) - | ValueOrCancelled.Cancelled _ -> () - - acc) - - let runWithoutCancellation comp = - use _ = Cancellable.UsingToken CancellationToken.None - let res = run CancellationToken.None comp - - match res with - | ValueOrCancelled.Cancelled _ -> failwith "unexpected cancellation" - | ValueOrCancelled.Value r -> r - - let toAsync c = - async { - use! _holder = Cancellable.UseToken() - - let! ct = Async.CancellationToken - - return! - Async.FromContinuations(fun (cont, _econt, ccont) -> - match run ct c with - | ValueOrCancelled.Value v -> cont v - | ValueOrCancelled.Cancelled ce -> ccont ce) - } - - let token () = Cancellable(ValueOrCancelled.Value) - -type CancellableBuilder() = - - member inline _.Delay([] f) = - Cancellable(fun ct -> - let (Cancellable g) = f () - g ct) - - member inline _.Bind(comp, [] k) = - Cancellable(fun ct -> - - __debugPoint "" - - match Cancellable.run ct comp with - | ValueOrCancelled.Value v1 -> Cancellable.run ct (k v1) - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.BindReturn(comp, [] k) = - Cancellable(fun ct -> - - __debugPoint "" - - match Cancellable.run ct comp with - | ValueOrCancelled.Value v1 -> ValueOrCancelled.Value(k v1) - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.Combine(comp1, comp2) = - Cancellable(fun ct -> - - __debugPoint "" - - match Cancellable.run ct comp1 with - | ValueOrCancelled.Value() -> Cancellable.run ct comp2 - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.TryWith(comp, [] handler) = - Cancellable(fun ct -> - - __debugPoint "" - - let compRes = - try - match Cancellable.run ct comp with - | ValueOrCancelled.Value res -> ValueOrCancelled.Value(Choice1Of2 res) - | ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn - with err -> - ValueOrCancelled.Value(Choice2Of2 err) - - match compRes with - | ValueOrCancelled.Value res -> - match res with - | Choice1Of2 r -> ValueOrCancelled.Value r - | Choice2Of2 err -> Cancellable.run ct (handler err) - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.Using(resource: _ MaybeNull, [] comp) = - Cancellable(fun ct -> - - __debugPoint "" - - let body = comp resource - - let compRes = - try - match Cancellable.run ct body with - | ValueOrCancelled.Value res -> ValueOrCancelled.Value(Choice1Of2 res) - | ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn - with err -> - ValueOrCancelled.Value(Choice2Of2 err) - - match compRes with - | ValueOrCancelled.Value res -> - Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions.Dispose resource - - match res with - | Choice1Of2 r -> ValueOrCancelled.Value r - | Choice2Of2 err -> raise err - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.TryFinally(comp, [] compensation) = - Cancellable(fun ct -> - - __debugPoint "" - - let compRes = - try - match Cancellable.run ct comp with - | ValueOrCancelled.Value res -> ValueOrCancelled.Value(Choice1Of2 res) - | ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn - with err -> - ValueOrCancelled.Value(Choice2Of2 err) - - match compRes with - | ValueOrCancelled.Value res -> - compensation () - - match res with - | Choice1Of2 r -> ValueOrCancelled.Value r - | Choice2Of2 err -> raise err - | ValueOrCancelled.Cancelled err1 -> ValueOrCancelled.Cancelled err1) - - member inline _.Return v = - Cancellable(fun _ -> ValueOrCancelled.Value v) - - member inline _.ReturnFrom(v: Cancellable<'T>) = v - - member inline _.Zero() = - Cancellable(fun _ -> ValueOrCancelled.Value()) - -[] -module CancellableAutoOpens = - let cancellable = CancellableBuilder() + // If we're not inside an async computation, the ambient cancellation token will be CancellationToken.None and nothing will happen + // otherwise, if we are inside an async computation, this will throw. + Async2.CheckAndThrowToken.Value.ThrowIfCancellationRequested() diff --git a/src/Compiler/Utilities/Cancellable.fsi b/src/Compiler/Utilities/Cancellable.fsi index 0d82faa68cb..ea928cd075f 100644 --- a/src/Compiler/Utilities/Cancellable.fsi +++ b/src/Compiler/Utilities/Cancellable.fsi @@ -1,79 +1,5 @@ namespace FSharp.Compiler -open System -open System.Threading - [] type Cancellable = - static member internal UseToken: unit -> Async - - static member HasCancellationToken: bool - static member Token: CancellationToken - static member CheckAndThrow: unit -> unit - static member TryCheckAndThrow: unit -> unit - -namespace Internal.Utilities.Library - -open System -open System.Threading - -[] -type internal ValueOrCancelled<'TResult> = - | Value of result: 'TResult - | Cancelled of ``exception``: OperationCanceledException - -/// Represents a synchronous, cold-start, cancellable computation with explicit representation of a cancelled result. -/// -/// A cancellable computation may be cancelled via a CancellationToken, which is propagated implicitly. -/// If cancellation occurs, it is propagated as data rather than by raising an OperationCanceledException. -[] -type internal Cancellable<'T> = Cancellable of (CancellationToken -> ValueOrCancelled<'T>) - -module internal Cancellable = - - /// Run a cancellable computation using the given cancellation token - val inline run: ct: CancellationToken -> Cancellable<'T> -> ValueOrCancelled<'T> - - val fold: f: ('State -> 'T -> Cancellable<'State>) -> acc: 'State -> seq: seq<'T> -> Cancellable<'State> - - /// Run the computation in a mode where it may not be cancelled. The computation never results in a - /// ValueOrCancelled.Cancelled. - val runWithoutCancellation: comp: Cancellable<'T> -> 'T - - /// Bind the cancellation token associated with the computation - val token: unit -> Cancellable - - val toAsync: Cancellable<'T> -> Async<'T> - -type internal CancellableBuilder = - - new: unit -> CancellableBuilder - - member inline BindReturn: comp: Cancellable<'T> * [] k: ('T -> 'U) -> Cancellable<'U> - - member inline Bind: comp: Cancellable<'T> * [] k: ('T -> Cancellable<'U>) -> Cancellable<'U> - - member inline Combine: comp1: Cancellable * comp2: Cancellable<'T> -> Cancellable<'T> - - member inline Delay: [] f: (unit -> Cancellable<'T>) -> Cancellable<'T> - - member inline Return: v: 'T -> Cancellable<'T> - - member inline ReturnFrom: v: Cancellable<'T> -> Cancellable<'T> - - member inline TryFinally: comp: Cancellable<'T> * [] compensation: (unit -> unit) -> Cancellable<'T> - - member inline TryWith: - comp: Cancellable<'T> * [] handler: (exn -> Cancellable<'T>) -> Cancellable<'T> - - member inline Using: - resource: 'Resource MaybeNull * [] comp: ('Resource MaybeNull -> Cancellable<'T>) -> - Cancellable<'T> - when 'Resource :> IDisposable and 'Resource: not struct and 'Resource: not null - - member inline Zero: unit -> Cancellable - -[] -module internal CancellableAutoOpens = - val cancellable: CancellableBuilder diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index 77e8f4b2137..6ad42b9372c 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -3,6 +3,7 @@ module CompilerService.AsyncMemoize open System open System.Threading open Internal.Utilities.Collections +open Internal.Utilities.Library open System.Threading.Tasks open System.Diagnostics @@ -36,7 +37,9 @@ let rec awaitEvents next condition = async { match! next () with | events when condition events -> return events - | _ -> return! awaitEvents next condition + | _ -> + do! Async.Sleep 1 + return! awaitEvents next condition } let rec eventsWhen next condition = @@ -68,7 +71,7 @@ let awaitHandle h = h |> Async.AwaitWaitHandle |> Async.Ignore [] let ``Basics``() = - let computation key = async { + let computation key = async2 { do! Async.Sleep 1 return key * 2 } @@ -85,8 +88,8 @@ let ``Basics``() = memoize.Get(wrapKey 3, computation 3) memoize.Get(wrapKey 2, computation 2) } - |> Async.Parallel - |> Async.RunSynchronously + |> Async2.Parallel + |> Async2.RunImmediate let expected = [| 10; 10; 4; 10; 6; 4|] @@ -105,7 +108,7 @@ let ``We can disconnect a request from a running job`` () = let cts = new CancellationTokenSource() let canFinish = new ManualResetEvent(false) - let computation = async { + let computation = async2 { do! awaitHandle canFinish } @@ -114,7 +117,7 @@ let ``We can disconnect a request from a running job`` () = let key = 1 - let task1 = Async.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) + let task1 = Async2.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) waitUntil events (received Started) cts.Cancel() @@ -133,7 +136,7 @@ let ``We can cancel a job`` () = let cts = new CancellationTokenSource() - let computation = async { + let computation = async2 { while true do do! Async.Sleep 1000 } @@ -143,7 +146,7 @@ let ``We can cancel a job`` () = let key = 1 - let task1 = Async.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) + let task1 = Async2.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) waitUntil events (received Started) @@ -160,7 +163,7 @@ let ``We can cancel a job`` () = let ``Job is restarted if first requestor cancels`` () = let jobCanComplete = new ManualResetEvent(false) - let computation key = async { + let computation key = async2 { do! awaitHandle jobCanComplete return key * 2 } @@ -172,7 +175,7 @@ let ``Job is restarted if first requestor cancels`` () = let key = 1 - let task1 = Async.StartAsTask( memoize.Get(wrapKey key, computation key), cancellationToken = cts1.Token) + let task1 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key), cancellationToken = cts1.Token) waitUntil events (received Started) cts1.Cancel() @@ -181,7 +184,7 @@ let ``Job is restarted if first requestor cancels`` () = waitUntil events (received Canceled) - let task2 = Async.StartAsTask( memoize.Get(wrapKey key, computation key)) + let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key)) waitUntil events (countOf Started >> (=) 2) @@ -202,7 +205,7 @@ let ``Job is actually cancelled and restarted`` () = let jobCanComplete = new ManualResetEvent(false) let mutable finishedCount = 0 - let computation = async { + let computation = async2 { do! awaitHandle jobCanComplete Interlocked.Increment &finishedCount |> ignore return 42 @@ -215,14 +218,14 @@ let ``Job is actually cancelled and restarted`` () = for i in 1 .. 10 do use cts = new CancellationTokenSource() - let task = Async.StartAsTask( memoize.Get(key, computation), cancellationToken = cts.Token) + let task = Async2.StartAsTask( memoize.Get(key, computation), cancellationToken = cts.Token) waitUntil events (received Started) cts.Cancel() assertTaskCanceled task waitUntil events (received Canceled) Assert.Equal(1, memoize.Count) - let _task2 = Async.StartAsTask( memoize.Get(key, computation)) + let _task2 = Async2.StartAsTask( memoize.Get(key, computation)) waitUntil events (received Started) @@ -237,7 +240,7 @@ let ``Job keeps running if only one requestor cancels`` () = let jobCanComplete = new ManualResetEvent(false) - let computation key = async { + let computation key = async2 { do! awaitHandle jobCanComplete return key * 2 } @@ -249,11 +252,11 @@ let ``Job keeps running if only one requestor cancels`` () = let key = 1 - let task1 = Async.StartAsTask( memoize.Get(wrapKey key, computation key)) + let task1 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key)) waitUntil events (received Started) - let task2 = Async.StartAsTask( memoize.Get(wrapKey key, computation key) |> Async.Ignore, cancellationToken = cts.Token) + let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key) |> Async2.Ignore, cancellationToken = cts.Token) waitUntil events (countOf Requested >> (=) 2) @@ -294,7 +297,7 @@ let ``Stress test`` () = let testTimeoutMs = threads * iterations * maxDuration * 2 let intenseComputation durationMs result = - async { + async2 { if rng.NextDouble() < exceptionProbability then raise (ExpectedException()) let s = Stopwatch.StartNew() @@ -305,7 +308,7 @@ let ``Stress test`` () = } let rec sleepyComputation durationMs result = - async { + async2 { if rng.NextDouble() < (exceptionProbability / (float durationMs / float stepMs)) then raise (ExpectedException()) if durationMs > 0 then @@ -316,7 +319,7 @@ let ``Stress test`` () = } let rec mixedComputation durationMs result = - async { + async2 { if durationMs > 0 then if rng.NextDouble() < 0.5 then let! _ = intenseComputation (min stepMs durationMs) () @@ -358,7 +361,7 @@ let ``Stress test`` () = let result = key * 2 let job = cache.Get(wrapKey key, computation durationMs result) let cts = new CancellationTokenSource() - let runningJob = Async.StartAsTask(job, cancellationToken = cts.Token) + let runningJob = Async2.StartAsTask(job, cancellationToken = cts.Token) cts.CancelAfter timeoutMs Interlocked.Increment &started |> ignore try @@ -402,7 +405,7 @@ let ``Cancel running jobs with the same key`` () = let jobCanContinue = new ManualResetEvent(false) - let work = async { + let work = async2 { do! awaitHandle jobCanContinue } @@ -415,7 +418,7 @@ let ``Cancel running jobs with the same key`` () = let cts = new CancellationTokenSource() let jobsToCancel = - [ for i in 1 .. 10 -> Async.StartAsTask(cache.Get(key i , work), cancellationToken = cts.Token) ] + [ for i in 1 .. 10 -> Async2.StartAsTask(cache.Get(key i , work), cancellationToken = cts.Token) ] waitUntil events (countOf Started >> (=) 10) @@ -426,7 +429,7 @@ let ``Cancel running jobs with the same key`` () = for job in jobsToCancel do assertTaskCanceled job // Start another request. - let job = cache.Get(key 11, work) |> Async.StartAsTask + let job = cache.Get(key 11, work) |> Async2.StartAsTask // up til now the jobs should have been running unobserved let current = eventsWhen events (received Requested) @@ -461,14 +464,14 @@ let ``Preserve thread static diagnostics`` () = let job1Cache = AsyncMemoize() let job2Cache = AsyncMemoize() - let job1 (input: string) = async { + let job1 (input: string) = async2 { let! _ = Async.Sleep (rng.Next(1, 30)) let ex = DummyException("job1 error") DiagnosticsThreadStatics.DiagnosticsLogger.ErrorR(ex) return Ok input } - let job2 (input: int) = async { + let job2 (input: int) = async2 { DiagnosticsThreadStatics.DiagnosticsLogger.Warning(DummyException("job2 error 1")) @@ -504,7 +507,7 @@ let ``Preserve thread static diagnostics`` () = member _.GetVersion() = rng.Next(1, 10) member _.GetLabel() = "job2" } - let! result = job2Cache.Get(key, job2 (i % 10)) + let! result = job2Cache.Get(key, job2 (i % 10)) |> Async2.StartAsTask let diagnostics = diagnosticsLogger.GetDiagnostics() @@ -535,7 +538,7 @@ let ``Preserve thread static diagnostics already completed job`` () = member _.GetVersion() = 1 member _.GetLabel() = "job1" } - let job (input: string) = async { + let job (input: string) = async2 { let ex = DummyException($"job {input} error") DiagnosticsThreadStatics.DiagnosticsLogger.ErrorR(ex) return Ok input @@ -547,8 +550,8 @@ let ``Preserve thread static diagnostics already completed job`` () = use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.Optimize) - let! _ = cache.Get(key, job "1" ) - let! _ = cache.Get(key, job "2" ) + let! _ = cache.Get(key, job "1" ) |> Async2.StartAsTask + let! _ = cache.Get(key, job "2" ) |> Async2.StartAsTask let diagnosticMessages = diagnosticsLogger.GetDiagnostics() |> Array.map (fun (d, _) -> d.Exception.Message) |> Array.toList @@ -567,7 +570,7 @@ let ``We get diagnostics from the job that failed`` () = member _.GetVersion() = 1 member _.GetLabel() = "job1" } - let job = async { + let job = async2 { let ex = DummyException($"job error") // no recovery @@ -580,7 +583,7 @@ let ``We get diagnostics from the job that failed`` () = SetThreadDiagnosticsLoggerNoUnwind logger - do! cache.Get(key, job ) |> Async.Catch |> Async.Ignore + do! cache.Get(key, job ) |> Async2.Catch |> Async2.Ignore |> Async2.StartAsTask let messages = logger.Diagnostics |> List.map fst |> List.map _.Exception.Message diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 8f5ace7aade..4921a11554c 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -314,12 +314,6 @@ - - - - - - @@ -354,6 +348,12 @@ + + + + + + diff --git a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs index 61140c40c33..6f5b2d053d4 100644 --- a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs @@ -17,14 +17,14 @@ module BuildGraphTests = [] let private createNode () = let o = obj () - GraphNode(async { + GraphNode(async2 { Assert.shouldBeTrue (o <> null) return 1 }), WeakReference(o) [] let ``Initialization of graph node should not have a computed value``() = - let node = GraphNode(async { return 1 }) + let node = GraphNode(async2 { return 1 }) Assert.shouldBeTrue(node.TryPeekValue().IsNone) Assert.shouldBeFalse(node.HasValue) @@ -34,23 +34,23 @@ module BuildGraphTests = let resetEventInAsync = new ManualResetEvent(false) let graphNode = - GraphNode(async { + GraphNode(async2 { resetEventInAsync.Set() |> ignore - let! _ = Async.AwaitWaitHandle(resetEvent) + let! _ = Async2.AwaitWaitHandle(resetEvent) return 1 }) let task1 = - async { + async2 { let! _ = graphNode.GetOrComputeValue() () - } |> Async.StartAsTask + } |> Async2.StartAsTask let task2 = - async { + async2 { let! _ = graphNode.GetOrComputeValue() () - } |> Async.StartAsTask + } |> Async2.StartAsTask resetEventInAsync.WaitOne() |> ignore resetEvent.Set() |> ignore @@ -67,14 +67,14 @@ module BuildGraphTests = let mutable computationCount = 0 let graphNode = - GraphNode(async { + GraphNode(async2 { computationCount <- computationCount + 1 return 1 }) - let work = Async.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() )) + let work = Async2.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() )) - Async.RunImmediate(work) + Async2.RunImmediate(work) |> ignore Assert.shouldBe 1 computationCount @@ -83,11 +83,11 @@ module BuildGraphTests = let ``Many requests to get a value asynchronously should get the correct value``() = let requests = 10000 - let graphNode = GraphNode(async { return 1 }) + let graphNode = GraphNode(async2 { return 1 }) - let work = Async.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() )) + let work = Async2.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() )) - let result = Async.RunImmediate(work) + let result = Async2.RunImmediate(work) Assert.shouldNotBeEmpty result Assert.shouldBe requests result.Length @@ -102,7 +102,7 @@ module BuildGraphTests = Assert.shouldBeTrue weak.IsAlive - Async.RunImmediate(graphNode.GetOrComputeValue()) + Async2.RunImmediate(graphNode.GetOrComputeValue()) |> ignore GC.Collect(2, GCCollectionMode.Forced, true) @@ -119,7 +119,7 @@ module BuildGraphTests = Assert.shouldBeTrue weak.IsAlive - Async.RunImmediate(Async.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() ))) + Async2.RunImmediate(Async2.Parallel(Array.init requests (fun _ -> graphNode.GetOrComputeValue() ))) |> ignore GC.Collect(2, GCCollectionMode.Forced, true) @@ -129,21 +129,21 @@ module BuildGraphTests = [] let ``A request can cancel``() = let graphNode = - GraphNode(async { + GraphNode(async2 { return 1 }) use cts = new CancellationTokenSource() let work = - async { + async2 { cts.Cancel() return! graphNode.GetOrComputeValue() } let ex = try - Async.RunImmediate(work, cancellationToken = cts.Token) + Async2.RunImmediate(work, cancellationToken = cts.Token) |> ignore failwith "Should have canceled" with @@ -157,23 +157,23 @@ module BuildGraphTests = let resetEvent = new ManualResetEvent(false) let graphNode = - GraphNode(async { - let! _ = Async.AwaitWaitHandle(resetEvent) + GraphNode(async2 { + let! _ = Async2.AwaitWaitHandle(resetEvent) return 1 }) use cts = new CancellationTokenSource() let task = - async { + async2 { cts.Cancel() resetEvent.Set() |> ignore } - |> Async.StartAsTask + |> Async2.StartAsTask let ex = try - Async.RunImmediate(graphNode.GetOrComputeValue(), cancellationToken = cts.Token) + Async2.RunImmediate(graphNode.GetOrComputeValue(), cancellationToken = cts.Token) |> ignore failwith "Should have canceled" with @@ -191,9 +191,9 @@ module BuildGraphTests = let mutable computationCount = 0 let graphNode = - GraphNode(async { + GraphNode(async2 { computationCountBeforeSleep <- computationCountBeforeSleep + 1 - let! _ = Async.AwaitWaitHandle(resetEvent) + let! _ = Async2.AwaitWaitHandle(resetEvent) computationCount <- computationCount + 1 return 1 }) @@ -201,7 +201,7 @@ module BuildGraphTests = use cts = new CancellationTokenSource() let work = - async { + async2 { let! _ = graphNode.GetOrComputeValue() () } @@ -210,15 +210,15 @@ module BuildGraphTests = for i = 0 to requests - 1 do if i % 10 = 0 then - Async.StartAsTask(work, cancellationToken = cts.Token) + Async2.StartAsTask(work, cancellationToken = cts.Token) |> tasks.Add else - Async.StartAsTask(work) + Async2.StartAsTask(work) |> tasks.Add cts.Cancel() resetEvent.Set() |> ignore - Async.RunImmediate(work) + Async2.RunImmediate(work) |> ignore Assert.shouldBeTrue cts.IsCancellationRequested @@ -244,8 +244,8 @@ module BuildGraphTests = let rng = Random() fun n -> rng.Next n - let job phase i = async { - do! random 10 |> Async.Sleep + let job phase i = async2 { + do! random 10 |> Task.Delay Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase) DiagnosticsThreadStatics.DiagnosticsLogger.DebugDisplay() |> Assert.shouldBe $"DiagnosticsLogger(CaptureDiagnosticsConcurrently {i})" @@ -254,7 +254,7 @@ module BuildGraphTests = } let work (phase: BuildPhase) = - async { + async2 { let n = 8 let logger = CapturingDiagnosticsLogger("test NodeCode") use _ = new CompilationGlobalsScope(logger, phase) @@ -286,8 +286,8 @@ module BuildGraphTests = let pickRandomPhase _ = phases[random phases.Length] Seq.init 100 pickRandomPhase |> Seq.map work - |> Async.Parallel - |> Async.RunSynchronously + |> Async2.Parallel + |> Async2.RunImmediate exception TestException @@ -355,7 +355,7 @@ module BuildGraphTests = Assert.shouldBeTrue (msg > prevError) prevError <- msg - let work i = async { + let work i = async2 { for c in 'A' .. 'F' do do! Async.SwitchToThreadPool() errorR (ExampleException $"%03d{i}{c}") @@ -365,12 +365,12 @@ module BuildGraphTests = let logger = DiagnosticsLoggerWithCallback errorCommitted use _ = UseDiagnosticsLogger logger - tasks |> Seq.take 50 |> MultipleDiagnosticsLoggers.Parallel |> Async.Ignore |> Async.RunImmediate + tasks |> Seq.take 50 |> MultipleDiagnosticsLoggers.Parallel |> Async2.Ignore |> Async2.RunImmediate // all errors committed errorCountShouldBe 300 - tasks |> Seq.skip 50 |> MultipleDiagnosticsLoggers.Sequential |> Async.Ignore |> Async.RunImmediate + tasks |> Seq.skip 50 |> MultipleDiagnosticsLoggers.Sequential |> Async2.Ignore |> Async2.RunImmediate errorCountShouldBe 600 @@ -381,17 +381,17 @@ module BuildGraphTests = use _ = UseDiagnosticsLogger (CapturingDiagnosticsLogger "test logger") let tasks = [ - async { failwith "computation failed" } + async2 { failwith "computation failed" } for i in 1 .. 300 do - async { + async2 { errorR (ExampleException $"{Interlocked.Increment(&count)}") error (ExampleException $"{Interlocked.Increment(&count)}") } ] task { - do! tasks |> MultipleDiagnosticsLoggers.Parallel |> Async.Catch |> Async.Ignore + do! tasks |> MultipleDiagnosticsLoggers.Parallel |> Async2.Catch |> Async2.Ignore |> Async2.StartAsTask // Diagnostics from all started tasks should be collected despite the exception. errorCountShouldBe count @@ -400,7 +400,7 @@ module BuildGraphTests = [] let ``AsyncLocal diagnostics context flows correctly`` () = - let work logger = async { + let work logger = async2 { SetThreadDiagnosticsLoggerNoUnwind logger errorR TestException @@ -422,17 +422,17 @@ module BuildGraphTests = loggerShouldBe logger errorCountShouldBe 3 - let workInner = async { - do! async.Zero() + let workInner = async2 { + do! async2 { } errorR TestException loggerShouldBe logger } - let! child = workInner |> Async.StartChild - let! childTask = workInner |> Async.StartChildAsTask + let! child = workInner |> Async2.StartChild + let! childTask = workInner |> Async2.StartChildAsTask do! child - do! childTask |> Async.AwaitTask + do! childTask errorCountShouldBe 5 } @@ -441,7 +441,7 @@ module BuildGraphTests = let logger = SimpleConcurrentLogger name work logger - Seq.init 10 init |> Async.Parallel |> Async.RunSynchronously |> ignore + Seq.init 10 init |> Async2.Parallel |> Async2.runWithoutCancellation |> ignore let logger = SimpleConcurrentLogger "main" use _ = UseDiagnosticsLogger logger @@ -492,53 +492,31 @@ module BuildGraphTests = Task.WaitAll(noErrorsTask, btask, task) - Seq.init 11 (fun _ -> async { errorR TestException; loggerShouldBe logger } ) |> Async.Parallel |> Async.RunSynchronously |> ignore + Seq.init 11 (fun _ -> async2 { errorR TestException; loggerShouldBe logger } ) |> Async2.Parallel |> Async2.RunImmediate |> ignore loggerShouldBe logger errorCountShouldBe 17 - async { - - // After Async.Parallel the continuation runs in the context of the last computation that finished. + async2 { do! - [ async { + [ async2 { SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger } ] - |> Async.Parallel - |> Async.Ignore - loggerShouldBe DiscardErrorsLogger - - SetThreadDiagnosticsLoggerNoUnwind logger + |> Async2.Parallel + |> Async2.Ignore - // On the other hand, MultipleDiagnosticsLoggers.Parallel restores caller's context. - do! - [ async { - SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger } ] - |> MultipleDiagnosticsLoggers.Parallel - |> Async.Ignore loggerShouldBe logger } - |> Async.RunImmediate - - // Synchronous code will affect current context: - - // This is synchronous, caller's context is affected - async { - SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger - do! Async.SwitchToNewThread() - loggerShouldBe DiscardErrorsLogger - } - |> Async.RunImmediate - loggerShouldBe DiscardErrorsLogger + |> Async2.RunImmediate SetThreadDiagnosticsLoggerNoUnwind logger // This runs in async continuation, so the context is forked. - async { + async2 { do! Async.Sleep 0 SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger do! Async.SwitchToNewThread() loggerShouldBe DiscardErrorsLogger } - |> Async.RunImmediate + |> Async2.RunImmediate loggerShouldBe logger diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index bd46be604f5..ad2f5e472c1 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -2011,12 +2011,7 @@ FSharp.Compiler.AbstractIL.ILBinaryReader: FSharp.Compiler.AbstractIL.ILBinaryRe FSharp.Compiler.AbstractIL.ILBinaryReader: FSharp.Compiler.AbstractIL.ILBinaryReader+MetadataOnlyFlag FSharp.Compiler.AbstractIL.ILBinaryReader: FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag FSharp.Compiler.AbstractIL.ILBinaryReader: FSharp.Compiler.AbstractIL.ILBinaryReader+Shim -FSharp.Compiler.Cancellable: Boolean HasCancellationToken -FSharp.Compiler.Cancellable: Boolean get_HasCancellationToken() -FSharp.Compiler.Cancellable: System.Threading.CancellationToken Token -FSharp.Compiler.Cancellable: System.Threading.CancellationToken get_Token() FSharp.Compiler.Cancellable: Void CheckAndThrow() -FSharp.Compiler.Cancellable: Void TryCheckAndThrow() FSharp.Compiler.CodeAnalysis.DelayedILModuleReader: System.String OutputFile FSharp.Compiler.CodeAnalysis.DelayedILModuleReader: System.String get_OutputFile() FSharp.Compiler.CodeAnalysis.DelayedILModuleReader: Void .ctor(System.String, Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,Microsoft.FSharp.Core.FSharpOption`1[System.IO.Stream]]) @@ -12451,10 +12446,170 @@ FSharp.Compiler.Xml.XmlDoc: System.String[] GetElaboratedXmlLines() FSharp.Compiler.Xml.XmlDoc: System.String[] UnprocessedLines FSharp.Compiler.Xml.XmlDoc: System.String[] get_UnprocessedLines() FSharp.Compiler.Xml.XmlDoc: Void .ctor(System.String[], FSharp.Compiler.Text.Range) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[Internal.Utilities.Library.Async2`1[T]] StartChild[T](Internal.Utilities.Library.Async2`1[T]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[Microsoft.FSharp.Core.FSharpChoice`2[T,System.Exception]] Catch[T](Internal.Utilities.Library.Async2`1[T]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[Microsoft.FSharp.Core.Unit] Ignore[a](Internal.Utilities.Library.Async2`1[a]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[System.Boolean] AwaitWaitHandle(System.Threading.WaitHandle) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[System.Threading.Tasks.Task`1[T]] StartChildAsTask[T](Internal.Utilities.Library.Async2`1[T]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[T] TryCancelled[T](Internal.Utilities.Library.Async2`1[T], Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[a[]] Parallel[a](System.Collections.Generic.IEnumerable`1[Internal.Utilities.Library.Async2`1[a]]) +Internal.Utilities.Library.Async2: Internal.Utilities.Library.Async2`1[a[]] Sequential[a](System.Collections.Generic.IEnumerable`1[Internal.Utilities.Library.Async2`1[a]]) +Internal.Utilities.Library.Async2: System.Threading.Tasks.Task`1[a] StartAsTask[a](Internal.Utilities.Library.Async2`1[a], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) +Internal.Utilities.Library.Async2: T RunImmediate[T](Internal.Utilities.Library.Async2`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) +Internal.Utilities.Library.Async2: T RunSynchronously[T](Internal.Utilities.Library.Async2`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) +Internal.Utilities.Library.Async2: Void Start[a](Internal.Utilities.Library.Async2`1[a], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) +Internal.Utilities.Library.Async2AutoOpens: Async2Builder async2 +Internal.Utilities.Library.Async2AutoOpens: Async2Builder get_async2() +Internal.Utilities.Library.Async2Implementation+Async2Builder: Internal.Utilities.Library.Async2`1[T] RunDynamic[T](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[T],T]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Internal.Utilities.Library.Async2`1[T] Run[T](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[T],T]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit] For[T,TOverall](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit]]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit] While[TOverall](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Boolean], Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit] Zero[TOverall]() +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T] Combine[TOverall,T](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T] Delay[TOverall,T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T] TryFinally[TOverall,T](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T], Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T] TryWith[TOverall,T](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T], Microsoft.FSharp.Core.FSharpFunc`2[System.Exception,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T] Using[Resource,TOverall,T](Resource, Microsoft.FSharp.Core.FSharpFunc`2[Resource,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[TOverall],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[T],a] Return[T,a](T) +Internal.Utilities.Library.Async2Implementation+Async2Builder: Void .ctor() +Internal.Utilities.Library.Async2Implementation+Async2Code: Boolean bindDynamic$W[a,b,c,d](Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Microsoft.FSharp.Core.CompilerServices.ResumableStateMachine`1[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a]] ByRef, b, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],d]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Boolean bindDynamic[a,b,c,d](Microsoft.FSharp.Core.CompilerServices.ResumableStateMachine`1[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a]] ByRef, b, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],d]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindAwaiter$W[a,U,Data,T](Microsoft.FSharp.Core.FSharpFunc`2[a,U], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a, Microsoft.FSharp.Core.FSharpFunc`2[U,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindAwaiter[a,U,Data,T](a, Microsoft.FSharp.Core.FSharpFunc`2[U,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindCancellable$W[a,b,U,Data,T](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,U], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,a], Microsoft.FSharp.Core.FSharpFunc`2[U,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindCancellableAwaiter$W[a,b,Data,c,T](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,a], Microsoft.FSharp.Core.FSharpFunc`2[b,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],c]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindCancellableAwaiter[a,b,Data,c,T](Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,a], Microsoft.FSharp.Core.FSharpFunc`2[b,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],c]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] bindCancellable[a,b,U,Data,T](Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,a], Microsoft.FSharp.Core.FSharpFunc`2[U,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] maybeBounce[a,b]() +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],c] filterCancellation[a,b,c](Microsoft.FSharp.Core.FSharpFunc`2[System.Exception,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b]], System.Exception) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],c] throwIfCancellationRequested[a,b,c](Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] bindAwaitable$W[a,b,c,d,e](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) +Internal.Utilities.Library.Async2Implementation+Async2Code: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] bindAwaitable[a,b,c,d,e](a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Boolean Awaited +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Boolean Equals(Async2Data`1) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Boolean Equals(Async2Data`1, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Boolean Equals(System.Object) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Int32 GetHashCode() +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Int32 GetHashCode(System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCompletionSource`1[t]] TailCallSource +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[t] MethodBuilder +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: System.Threading.CancellationToken CancellationToken +Internal.Utilities.Library.Async2Implementation+Async2Data`1[t]: t Result +Internal.Utilities.Library.Async2Implementation+Async2Dynamic`2[t,m]: Internal.Utilities.Library.Async2`1[t] GetCopy(Boolean) +Internal.Utilities.Library.Async2Implementation+Async2Dynamic`2[t,m]: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[System.Boolean,m]) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Boolean Equals(Async2`2) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Boolean Equals(Async2`2, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Boolean Equals(System.Object) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Int32 GetHashCode() +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Int32 GetHashCode(System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: Internal.Utilities.Library.IAsync2Invocation`1[t] Start(System.Threading.CancellationToken, Boolean, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCompletionSource`1[t]]) +Internal.Utilities.Library.Async2Implementation+Async2`2[t,m]: m StateMachine +Internal.Utilities.Library.Async2Implementation+Awaitable: b getAwaiter$W[a,b,c](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], a) +Internal.Utilities.Library.Async2Implementation+Awaitable: b getAwaiter[a,b,c](a) +Internal.Utilities.Library.Async2Implementation+Awaiter: Boolean isCompleted$W[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a) +Internal.Utilities.Library.Async2Implementation+Awaiter: Boolean isCompleted[a,b](a) +Internal.Utilities.Library.Async2Implementation+Awaiter: Void onCompleted$W[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a, System.Action) +Internal.Utilities.Library.Async2Implementation+Awaiter: Void onCompleted[a,b](a, System.Action) +Internal.Utilities.Library.Async2Implementation+Awaiter: Void unsafeOnCompleted$W[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a, System.Action) +Internal.Utilities.Library.Async2Implementation+Awaiter: Void unsafeOnCompleted[a,b](a, System.Action) +Internal.Utilities.Library.Async2Implementation+Awaiter: b getResult$W[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a) +Internal.Utilities.Library.Async2Implementation+Awaiter: b getResult[a,b](a) +Internal.Utilities.Library.Async2Implementation+DynamicState+Awaiting: System.Runtime.CompilerServices.ICriticalNotifyCompletion Item +Internal.Utilities.Library.Async2Implementation+DynamicState+Awaiting: System.Runtime.CompilerServices.ICriticalNotifyCompletion get_Item() +Internal.Utilities.Library.Async2Implementation+DynamicState+Bounce: DynamicState Item +Internal.Utilities.Library.Async2Implementation+DynamicState+Bounce: DynamicState get_Item() +Internal.Utilities.Library.Async2Implementation+DynamicState+Immediate: DynamicState Item +Internal.Utilities.Library.Async2Implementation+DynamicState+Immediate: DynamicState get_Item() +Internal.Utilities.Library.Async2Implementation+DynamicState+SetException: System.Runtime.ExceptionServices.ExceptionDispatchInfo Item +Internal.Utilities.Library.Async2Implementation+DynamicState+SetException: System.Runtime.ExceptionServices.ExceptionDispatchInfo get_Item() +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 Awaiting +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 Bounce +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 Immediate +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 Running +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 SetException +Internal.Utilities.Library.Async2Implementation+DynamicState+Tags: Int32 SetResult +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean Equals(DynamicState) +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean Equals(DynamicState, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean Equals(System.Object) +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsAwaiting +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsBounce +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsImmediate +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsRunning +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsSetException +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean IsSetResult +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsAwaiting() +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsBounce() +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsImmediate() +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsRunning() +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsSetException() +Internal.Utilities.Library.Async2Implementation+DynamicState: Boolean get_IsSetResult() +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState NewAwaiting(System.Runtime.CompilerServices.ICriticalNotifyCompletion) +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState NewBounce(DynamicState) +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState NewImmediate(DynamicState) +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState NewSetException(System.Runtime.ExceptionServices.ExceptionDispatchInfo) +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState Running +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState SetResult +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState get_Running() +Internal.Utilities.Library.Async2Implementation+DynamicState: DynamicState get_SetResult() +Internal.Utilities.Library.Async2Implementation+DynamicState: Int32 GetHashCode() +Internal.Utilities.Library.Async2Implementation+DynamicState: Int32 GetHashCode(System.Collections.IEqualityComparer) +Internal.Utilities.Library.Async2Implementation+DynamicState: Int32 Tag +Internal.Utilities.Library.Async2Implementation+DynamicState: Int32 get_Tag() +Internal.Utilities.Library.Async2Implementation+DynamicState: Internal.Utilities.Library.Async2Implementation+DynamicState+Awaiting +Internal.Utilities.Library.Async2Implementation+DynamicState: Internal.Utilities.Library.Async2Implementation+DynamicState+Bounce +Internal.Utilities.Library.Async2Implementation+DynamicState: Internal.Utilities.Library.Async2Implementation+DynamicState+Immediate +Internal.Utilities.Library.Async2Implementation+DynamicState: Internal.Utilities.Library.Async2Implementation+DynamicState+SetException +Internal.Utilities.Library.Async2Implementation+DynamicState: Internal.Utilities.Library.Async2Implementation+DynamicState+Tags +Internal.Utilities.Library.Async2Implementation+DynamicState: System.String ToString() +Internal.Utilities.Library.Async2Implementation+ExceptionCache: System.Runtime.CompilerServices.ConditionalWeakTable`2[System.Exception,System.Runtime.ExceptionServices.ExceptionDispatchInfo] get_store() +Internal.Utilities.Library.Async2Implementation+ExceptionCache: System.Runtime.CompilerServices.ConditionalWeakTable`2[System.Exception,System.Runtime.ExceptionServices.ExceptionDispatchInfo] store +Internal.Utilities.Library.Async2Implementation+ExceptionCache: System.Runtime.ExceptionServices.ExceptionDispatchInfo CaptureOrRetrieve(System.Exception) +Internal.Utilities.Library.Async2Implementation+ExceptionCache: a Throw[a](System.Exception) +Internal.Utilities.Library.Async2Implementation+ExceptionCache: b GetResultOrThrow$W[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[a,System.Boolean], a) +Internal.Utilities.Library.Async2Implementation+ExceptionCache: b GetResultOrThrow[a,b](a) +Internal.Utilities.Library.Async2Implementation+Trampoline: Boolean ShouldBounce +Internal.Utilities.Library.Async2Implementation+Trampoline: Boolean get_ShouldBounce() +Internal.Utilities.Library.Async2Implementation+Trampoline: Microsoft.FSharp.Core.FSharpRef`1[System.Runtime.CompilerServices.ICriticalNotifyCompletion] Ref +Internal.Utilities.Library.Async2Implementation+Trampoline: Microsoft.FSharp.Core.FSharpRef`1[System.Runtime.CompilerServices.ICriticalNotifyCompletion] get_Ref() +Internal.Utilities.Library.Async2Implementation+Trampoline: Trampoline Current +Internal.Utilities.Library.Async2Implementation+Trampoline: Trampoline get_Current() +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Async2Builder +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Async2Code +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Async2Data`1[t] +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Async2Dynamic`2[t,m] +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Async2`2[t,m] +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Awaitable +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Awaiter +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+DynamicState +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+ExceptionCache +Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Trampoline +Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[System.Threading.CancellationToken] CancellationToken +Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[System.Threading.CancellationToken] get_CancellationToken() +Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[t] fromValue[t](t) +Internal.Utilities.Library.Async2Module: Microsoft.FSharp.Control.FSharpAsync`1[t] toAsync[t](Internal.Utilities.Library.Async2`1[t]) +Internal.Utilities.Library.Async2Module: System.Threading.AsyncLocal`1[System.Threading.CancellationToken] CheckAndThrowToken +Internal.Utilities.Library.Async2Module: System.Threading.AsyncLocal`1[System.Threading.CancellationToken] get_CheckAndThrowToken() +Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[a] startAsTaskWithoutCancellation[a](Internal.Utilities.Library.Async2`1[a]) +Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[a] startImmediate[a](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[a]) +Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[t] startInThreadPool[t](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[t]) +Internal.Utilities.Library.Async2Module: a runWithoutCancellation[a](Internal.Utilities.Library.Async2`1[a]) +Internal.Utilities.Library.Async2Module: t run[t](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[t]) +Internal.Utilities.Library.Async2`1[t]: Internal.Utilities.Library.IAsync2Invocation`1[t] Await(System.Threading.CancellationToken) +Internal.Utilities.Library.Async2`1[t]: Internal.Utilities.Library.IAsync2Invocation`1[t] Start(System.Threading.CancellationToken) +Internal.Utilities.Library.Async2`1[t]: Void TailCall(System.Threading.CancellationToken, System.Threading.Tasks.TaskCompletionSource`1[t]) Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: System.Collections.Generic.IDictionary`2[TDictKey,TDictValue] CreateDictionary(T[]) Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: System.Collections.Generic.IDictionary`2[TDictKey,TDictValue] GetDictionary() Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: T[] GetArray() Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T[]]) +Internal.Utilities.Library.HighPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T] Async2Builder.Bind[U,Data,T](Async2Builder, Internal.Utilities.Library.Async2`1[U], Microsoft.FSharp.Core.FSharpFunc`2[U,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Data],T]]) +Internal.Utilities.Library.HighPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[T],T] Async2Builder.ReturnFrom[T](Async2Builder, Internal.Utilities.Library.Async2`1[T]) +Internal.Utilities.Library.HighPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[T],a] Async2Builder.ReturnFromFinal[T,a](Async2Builder, Internal.Utilities.Library.Async2`1[T]) +Internal.Utilities.Library.IAsync2Invocation`1[t]: System.Runtime.CompilerServices.TaskAwaiter`1[t] GetAwaiter() +Internal.Utilities.Library.IAsync2Invocation`1[t]: System.Threading.Tasks.Task`1[t] Task +Internal.Utilities.Library.IAsync2Invocation`1[t]: System.Threading.Tasks.Task`1[t] get_Task() Internal.Utilities.Library.InterruptibleLazy: T force[T](Internal.Utilities.Library.InterruptibleLazy`1[T]) Internal.Utilities.Library.InterruptibleLazy`1[T]: Boolean IsValueCreated Internal.Utilities.Library.InterruptibleLazy`1[T]: Boolean get_IsValueCreated() @@ -12462,4 +12617,19 @@ Internal.Utilities.Library.InterruptibleLazy`1[T]: Internal.Utilities.Library.In Internal.Utilities.Library.InterruptibleLazy`1[T]: T Force() Internal.Utilities.Library.InterruptibleLazy`1[T]: T Value Internal.Utilities.Library.InterruptibleLazy`1[T]: T get_Value() -Internal.Utilities.Library.InterruptibleLazy`1[T]: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T]) \ No newline at end of file +Internal.Utilities.Library.InterruptibleLazy`1[T]: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T]) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[c],d] Async2Builder.ReturnFrom$W[a,b,c,d](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Async2Builder, a) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[c],d] Async2Builder.ReturnFromFinal$W[a,b,c,d](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Async2Builder, a) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[c],d] Async2Builder.ReturnFromFinal[a,b,c,d](Async2Builder, a) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[c],d] Async2Builder.ReturnFrom[a,b,c,d](Async2Builder, a) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind$W[a,b,c,d,e](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) +Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind[a,b,c,d,e](Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFromFinal[a](Async2Builder, System.Threading.Tasks.Task) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFrom[a](Async2Builder, System.Threading.Tasks.Task) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.Bind[a,b](Async2Builder, System.Threading.Tasks.Task, Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b]]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFromFinal[a,b](Async2Builder, Microsoft.FSharp.Control.FSharpAsync`1[a]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFromFinal[a,b](Async2Builder, System.Threading.Tasks.Task`1[a]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFrom[a,b](Async2Builder, Microsoft.FSharp.Control.FSharpAsync`1[a]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFrom[a,b](Async2Builder, System.Threading.Tasks.Task`1[a]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[b],c] Async2Builder.Bind[a,b,c](Async2Builder, System.Threading.Tasks.Task`1[a], Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[b],c]]) +Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[b],d] Async2Builder.Bind[a,b,c,d](Async2Builder, Microsoft.FSharp.Control.FSharpAsync`1[a], Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[b],c]]) \ No newline at end of file diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index f307586cd5c..2dd72a0b93e 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -150,7 +150,7 @@ let parseAndCheck path source options = | _, FSharpCheckFileAnswer.Aborted -> None | _, FSharpCheckFileAnswer.Succeeded results -> Some results - Cancellable.HasCancellationToken |> shouldEqual false + Async2.CheckAndThrowToken.Value |> shouldEqual CancellationToken.None result with :? OperationCanceledException -> @@ -173,11 +173,6 @@ open Ns1.Ns2 let t: T = T() """ - -[] -let ``CheckAndThrow is not allowed to throw outside of cancellable`` () = - Assert.Throws(fun () -> Cancellable.CheckAndThrow()) - [] let ``Type defs 01 - assembly import`` () = let source = source1 diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net10.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net10.0.bsl index 470ea6b368f..6feff7d52c1 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net10.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net10.0.bsl @@ -37,6 +37,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getOptionArgList::Invoke([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x0000003E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getSwitch::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInput::MoveNext()][offset 0x00000E6B][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInputWithCallback::MoveNext()][offset 0x00000ACC][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. @@ -58,6 +60,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : .$AsyncMemoize+clo::MoveNext()][offset 0x00000859][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index 61040597ad0..19041e1ded0 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -28,8 +28,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x0000001B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [UnmanagedPointer]: : FSharp.Compiler.Interactive.Shell+Utilities+pointerToNativeInt::Invoke(object)][offset 0x00000007] Unmanaged pointers are not a verifiable type. [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. @@ -53,6 +53,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+processArg::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x0000004D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine::Invoke(string)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInput::MoveNext()][offset 0x00000E6B][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInputWithCallback::MoveNext()][offset 0x00000ACC][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. @@ -81,6 +83,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000048][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : .$AsyncMemoize+clo::MoveNext()][offset 0x00000859][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input ::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net10.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net10.0.bsl index e29bd8bbaec..dcc870bee8c 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net10.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net10.0.bsl @@ -32,13 +32,15 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::parseOption(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getOptionArgList([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x00000049][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getOptionArgList([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x00000052][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getSwitch(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::attempt([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000A99][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInput::MoveNext()][offset 0x00000DF0][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInputWithCallback::MoveNext()][offset 0x000009FD][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. @@ -74,8 +76,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006B6][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. @@ -84,6 +86,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : .$AsyncMemoize+clo::MoveNext()][offset 0x000006DF][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 2d4250700df..5d4d25f358f 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -28,8 +28,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x00000024][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. @@ -45,16 +45,18 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CreateILModule+MainModuleBuilder::ConvertProductVersionToILVersionInfo(string)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::parseOption(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getOptionArgList([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x00000049][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getOptionArgList([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x00000052][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getSwitch(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::attempt([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000A99][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::processArg([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x0000003E][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::subSystemVersionSwitch$cont([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine::Invoke(string)][offset 0x00000026][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInput::MoveNext()][offset 0x00000DF0][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. +[IL]: Error [PathStackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckOneInputWithCallback::MoveNext()][offset 0x000009FD][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. @@ -95,8 +97,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006B6][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. @@ -108,6 +110,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [PathStackUnexpected]: : .$AsyncMemoize+clo::MoveNext()][offset 0x000006DF][found Int32][expected Nullobjref 'NullReference'] Non-compatible types on stack depending on path. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 518bf88bc74..2f6d923770b 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -11,7 +11,6 @@ open FSharp.Compiler open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.CodeAnalysis.ProjectSnapshot open FSharp.Compiler.Symbols -open FSharp.Compiler.BuildGraph open CancellableTasks @@ -20,7 +19,6 @@ open System.IO open Internal.Utilities.Collections open Newtonsoft.Json open Newtonsoft.Json.Linq -open System.Text.Json.Nodes #nowarn "57" // Experimental stuff @@ -377,7 +375,7 @@ module private CheckerExtensions = member _.GetLabel() = project.FilePath } - snapshotCache.Get( + snapshotCache.GetAsync( key, async { let! ct = Async.CancellationToken From 2c0cbae36f01f49c8c1d2e36980135224cf8229c Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 13:00:34 +0100 Subject: [PATCH 02/43] add test --- .../Language/StateMachineTests.fs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index 86e11cf2029..96828085587 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -5,6 +5,7 @@ namespace Language open Xunit open FSharp.Test.Compiler open FSharp.Test +open FSharp.Test.Assert module StateMachineTests = @@ -241,3 +242,47 @@ let test = task { return 42 } IL_0059: ret } """ ] + + [] + let ``Nested __useResumableCode is expanded correctly`` () = + FSharp """ +module TestStateMachine + +open FSharp.Core.CompilerServices +open FSharp.Core.CompilerServices.StateMachineHelpers +open System.Runtime.CompilerServices + +let inline MoveOnce(x: byref<'T> when 'T :> IAsyncStateMachine and 'T :> IResumableStateMachine<'Data>) = + x.MoveNext() + x.Data + +// An inline helper returning ResumableCode must be fully expanded +// before the compiler tries to recognize the enclosing __stateMachine construct. +let inline helper x = + ResumableCode(fun sm -> + if __useResumableCode then + sm.Data <- x + true + else + failwith "unexpected dynamic branch at runtime") + +#nowarn 3513 +let inline repro x = + if __useResumableCode then + __stateMachine + (MoveNextMethodImpl<_>(fun sm -> (helper x).Invoke(&sm) |> ignore)) + (SetStateMachineMethodImpl<_>(fun _ _ -> ())) + (AfterCode<_, _>(fun sm -> MoveOnce(&sm))) + else + failwith "dynamic state machine" + +[] +let main _ = + let result = repro 42 + if result <> 42 then + failwithf "Expected 42 but got %d" result + 0 +""" + |> withOptimize + |> compileExeAndRun + |> shouldSucceed From 2f16b593f5fc4cee02b390fdaa98cb946c76d647 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 13:02:01 +0100 Subject: [PATCH 03/43] fix expansion of nested if __useResumableCode --- src/Compiler/Optimize/LowerStateMachines.fs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 90238e0dc3c..36db5081ee6 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -349,7 +349,11 @@ type LowerStateMachine(g: TcGlobals) = // Repeated top-down rewrite let makeRewriteEnv (env: env) = - { PreIntercept = Some (fun cont e -> match TryReduceExpr env e [] id with Some e2 -> Some (cont e2) | None -> None) + { PreIntercept = Some (fun cont e -> + match e with + | IfUseResumableStateMachinesExpr g (thenExpr, _) -> Some (cont thenExpr) + | _ -> + match TryReduceExpr env e [] id with Some e2 -> Some (cont e2) | None -> None) PostTransform = (fun _ -> None) PreInterceptBinding = None RewriteQuotations=true From 904da826a9bc738284fcb13b6c6f28fdf4ea1e97 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:02:34 +0100 Subject: [PATCH 04/43] wip --- src/Compiler/Optimize/LowerStateMachines.fs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 36db5081ee6..2c4b8d326f7 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -351,6 +351,14 @@ type LowerStateMachine(g: TcGlobals) = let makeRewriteEnv (env: env) = { PreIntercept = Some (fun cont e -> match e with + // Don't recurse into nested state machine expressions - they will be + // processed by their own LowerStateMachineExpr during codegen. + // This prevents modification of the nested machine's internal + // 'if __useResumableCode' patterns which select its dynamic fallback. + | _ when Option.isSome (IsStateMachineExpr g e) -> Some e + // Eliminate 'if __useResumableCode' - nested state machines are already + // guarded above, so any remaining occurrences at this level are from + // beta-reduced inline helpers and should take the static branch. | IfUseResumableStateMachinesExpr g (thenExpr, _) -> Some (cont thenExpr) | _ -> match TryReduceExpr env e [] id with Some e2 -> Some (cont e2) | None -> None) From 52c64f023a3035e4283ace3c9d0cbbee0e4b3e9d Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 20:44:06 +0100 Subject: [PATCH 05/43] fix static compilation of some nested tasks Improve reduction of resumable code in state machines Enhance application reduction in state machine lowering for F# computation expressions by tracking let-bound resumable code in the environment and resolving references during reduction. This enables correct handling of optimizer-generated continuations and deeper reduction of nested applications. Also, update test comments to reflect resolved state machine compilation issues. --- src/Compiler/Optimize/LowerStateMachines.fs | 19 ++++++++++++++++++- .../NestedTaskFailures.fs | 4 +--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 2c4b8d326f7..0f51c070e07 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -235,7 +235,16 @@ type LowerStateMachine(g: TcGlobals) = TryReduceApp env expandedExpr laterArgs | Expr.Let (bind, bodyExpr, m, _) -> - match TryReduceApp env bodyExpr args with + // If the binding returns resumable code, add it to the env so that + // references to it in the body can be resolved during reduction. + // This handles patterns like 'let cont = (fun () -> ...; Zero()) in cont()' + // generated by the optimizer for CE if-then branches. + let envR = + if isExpandVar g bind.Var then + { env with ResumableCodeDefns = env.ResumableCodeDefns.Add bind.Var bind.Expr } + else + env + match TryReduceApp envR bodyExpr args with | Some bodyExpr2 -> Some (mkLetBind m bind bodyExpr2) | None -> None @@ -308,6 +317,14 @@ type LowerStateMachine(g: TcGlobals) = | Some innerExpr2 -> Some (Expr.DebugPoint (dp, innerExpr2)) | None -> None + // Resolve variables known to the env, e.g. locally-bound resumable code continuations + | Expr.Val (vref, _, _) when env.ResumableCodeDefns.ContainsVal vref.Deref -> + TryReduceApp env env.ResumableCodeDefns[vref.Deref] args + + // Push through function applications by combining the arg lists + | Expr.App (f, _fty, _tyargs, fArgs, _m) -> + TryReduceApp env f (fArgs @ args) + | _ -> None diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs index 7313ad61b87..e051ee0c40e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs @@ -1,10 +1,8 @@ namespace FSharp.Core.UnitTests.Control.Tasks -// The tasks below fail state machine compilation. This failure was causing subsequent problems in code generation. +// The tasks below used to fail state machine compilation. This failure was causing subsequent problems in code generation. // See https://github.com/dotnet/fsharp/issues/13404 -#nowarn "3511" // state machine not statically compilable - this is a separate issue, see https://github.com/dotnet/fsharp/issues/13404 - open System open Microsoft.FSharp.Control open Xunit From d63dc853c9d2e98574c800521e981e7c2c1ccd70 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:13:12 +0100 Subject: [PATCH 06/43] directly compile the test --- .../Language/StateMachineTests.fs | 85 +++++++++---------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index 96828085587..b121b63a501 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -3,9 +3,41 @@ namespace Language open Xunit -open FSharp.Test.Compiler -open FSharp.Test open FSharp.Test.Assert +open FSharp.Test.Compiler + + +// Inlined helper containing a "if __useResumableCode ..." construct failed to expand correctly, +// executing the dynmamic branch at runtime even when the state maching was compiled statically. +// see https://github.com/dotnet/fsharp/issues/19296 +module FailingInlinedHelper = + open FSharp.Core.CompilerServices + open FSharp.Core.CompilerServices.StateMachineHelpers + open System.Runtime.CompilerServices + + let inline MoveOnce(x: byref<'T> when 'T :> IAsyncStateMachine and 'T :> IResumableStateMachine<'Data>) = + x.MoveNext() + x.Data + + // An inline helper returning ResumableCode must be fully expanded + // before the compiler tries to recognize the enclosing __stateMachine construct. + let inline helper x = + ResumableCode(fun sm -> + if __useResumableCode then + sm.Data <- x + true + else + failwith "unexpected dynamic branch at runtime") + + #nowarn 3513 + let inline repro x = + if __useResumableCode then + __stateMachine + (MoveNextMethodImpl<_>(fun sm -> (helper x).Invoke(&sm) |> ignore)) + (SetStateMachineMethodImpl<_>(fun _ _ -> ())) + (AfterCode<_, _>(fun sm -> MoveOnce(&sm))) + else + failwith "dynamic state machine" module StateMachineTests = @@ -22,6 +54,11 @@ module StateMachineTests = |> withOptions ["--nowarn:3511"] |> compileExeAndRun + [] + let ``Nested __useResumableCode is expanded correctly`` () = + FailingInlinedHelper.repro 42 + |> shouldEqual 42 + [] // https://github.com/dotnet/fsharp/issues/13067 let ``Local function with a flexible type``() = """ @@ -242,47 +279,3 @@ let test = task { return 42 } IL_0059: ret } """ ] - - [] - let ``Nested __useResumableCode is expanded correctly`` () = - FSharp """ -module TestStateMachine - -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers -open System.Runtime.CompilerServices - -let inline MoveOnce(x: byref<'T> when 'T :> IAsyncStateMachine and 'T :> IResumableStateMachine<'Data>) = - x.MoveNext() - x.Data - -// An inline helper returning ResumableCode must be fully expanded -// before the compiler tries to recognize the enclosing __stateMachine construct. -let inline helper x = - ResumableCode(fun sm -> - if __useResumableCode then - sm.Data <- x - true - else - failwith "unexpected dynamic branch at runtime") - -#nowarn 3513 -let inline repro x = - if __useResumableCode then - __stateMachine - (MoveNextMethodImpl<_>(fun sm -> (helper x).Invoke(&sm) |> ignore)) - (SetStateMachineMethodImpl<_>(fun _ _ -> ())) - (AfterCode<_, _>(fun sm -> MoveOnce(&sm))) - else - failwith "dynamic state machine" - -[] -let main _ = - let result = repro 42 - if result <> 42 then - failwithf "Expected 42 but got %d" result - 0 -""" - |> withOptimize - |> compileExeAndRun - |> shouldSucceed From 574b9d872b3e324b914b2395a2a4cbc11574a627 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:22:09 +0100 Subject: [PATCH 07/43] fix comments --- .../Language/StateMachineTests.fs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index b121b63a501..1a6ef7da947 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -8,7 +8,7 @@ open FSharp.Test.Compiler // Inlined helper containing a "if __useResumableCode ..." construct failed to expand correctly, -// executing the dynmamic branch at runtime even when the state maching was compiled statically. +// executing the dynmamic branch at runtime even when the state machine was compiled statically. // see https://github.com/dotnet/fsharp/issues/19296 module FailingInlinedHelper = open FSharp.Core.CompilerServices @@ -19,8 +19,6 @@ module FailingInlinedHelper = x.MoveNext() x.Data - // An inline helper returning ResumableCode must be fully expanded - // before the compiler tries to recognize the enclosing __stateMachine construct. let inline helper x = ResumableCode(fun sm -> if __useResumableCode then @@ -29,7 +27,7 @@ module FailingInlinedHelper = else failwith "unexpected dynamic branch at runtime") - #nowarn 3513 + #nowarn 3513 // Resumable code invocation. let inline repro x = if __useResumableCode then __stateMachine @@ -38,6 +36,7 @@ module FailingInlinedHelper = (AfterCode<_, _>(fun sm -> MoveOnce(&sm))) else failwith "dynamic state machine" + #warnon 3513 module StateMachineTests = From 250c218e413cf7c4a407707b759a108c27fdefd0 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 16 Feb 2026 23:21:14 +0100 Subject: [PATCH 08/43] add repro cases - for loop over tuples --- .../Language/StateMachineTests.fs | 90 +++++++------------ 1 file changed, 30 insertions(+), 60 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index 1a6ef7da947..07cd86a8545 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -218,63 +218,33 @@ module TestStateMachine let test = task { return 42 } """ |> compile - |> verifyIL [ """ -.method public strict virtual instance void MoveNext() cil managed -{ - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 4 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - class [runtime]System.Exception V_3) - IL_0000: ldarg.0 - IL_0001: ldfld int32 TestStateMachine/test@3::ResumptionPoint - IL_0006: stloc.0 - .try - { - IL_0007: ldarg.0 - IL_0008: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 TestStateMachine/test@3::Data - IL_000d: ldc.i4.s 42 - IL_000f: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0014: ldc.i4.1 - IL_0015: stloc.2 - IL_0016: ldloc.2 - IL_0017: brfalse.s IL_0036 - - IL_0019: ldarg.0 - IL_001a: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 TestStateMachine/test@3::Data - IL_001f: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0024: ldarg.0 - IL_0025: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 TestStateMachine/test@3::Data - IL_002a: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_002f: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_0034: leave.s IL_0042 - - IL_0036: leave.s IL_0042 - - } - catch [runtime]System.Object - { - IL_0038: castclass [runtime]System.Exception - IL_003d: stloc.3 - IL_003e: ldloc.3 - IL_003f: stloc.1 - IL_0040: leave.s IL_0042 - - } - IL_0042: ldloc.1 - IL_0043: stloc.3 - IL_0044: ldloc.3 - IL_0045: brtrue.s IL_0048 - - IL_0047: ret - - IL_0048: ldarg.0 - IL_0049: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 TestStateMachine/test@3::Data - IL_004e: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0053: ldloc.3 - IL_0054: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0059: ret -} -""" ] + |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + + // The original repro from https://github.com/dotnet/fsharp/pull/14930 + [] + let ``Task with for loop over tuples compiles statically`` () = + FSharp """ +module TestStateMachine +let what (f: seq) = task { + for name, _whatever in f do + System.Console.Write name +} + """ + |> compile + |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + + // The original repro from https://github.com/dotnet/fsharp/issues/12839#issuecomment-2562121004 + [] + let ``Task with for loop over tuples compiles statically 2`` () = + FSharp """ +module TestStateMachine +let test = task { + for _ in [ "a", "b" ] do + () +} + """ + |> compile + |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + + + From 78d272e4d78c033fc62d5186c4e33e433eb51f7e Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Tue, 17 Feb 2026 09:31:03 +0100 Subject: [PATCH 09/43] include test and debugpoint handling from #14930 --- src/Compiler/Optimize/LowerStateMachines.fs | 5 + .../Language/StateMachineTests.fs | 92 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 0f51c070e07..5d0bcad002f 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -189,6 +189,11 @@ type LowerStateMachine(g: TcGlobals) = if sm_verbose then printfn "eliminating 'if __useResumableCode...'" BindResumableCodeDefinitions env thenExpr + // Look through debug points to find resumable code bindings inside + | Expr.DebugPoint (_, innerExpr) -> + let envR, _ = BindResumableCodeDefinitions env innerExpr + (envR, expr) + | _ -> (env, expr) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index 07cd86a8545..d5095dc7625 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -247,4 +247,96 @@ let test = task { |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + [] // https://github.com/dotnet/fsharp/issues/12839#issuecomment-1292310944 + let ``Tasks with a for loop over tuples are statically compilable``() = + FSharp """ +module TestProject1 + +let ret i = task { return i } + +let one (f: seq) = task { + let mutable sum = 0 + + let! x = ret 1 + sum <- sum + x + + for name, _whatever, i in f do + let! x = ret i + sum <- sum + x + + System.Console.Write name + + let! x = ret i + sum <- sum + x + + let! x = ret 1 + sum <- sum + x + + return sum +} + +let two (f: seq) = task { + let mutable sum = 0 + + let! x = ret 1 + sum <- sum + x + + for name, _whatever, i in f do + let! x = ret i + sum <- sum + x + + System.Console.Write name + + let! x = ret 1 + sum <- sum + x + + return sum +} + +let three (f: seq) = task { + let mutable sum = 0 + + let! x = ret 1 + sum <- sum + x + + for name, _whatever, i in f do + let! x = ret i + sum <- sum + x + + System.Console.Write name + + return sum +} + +let four (f: seq) = task { + let mutable sum = 0 + + let! x = ret 5 + sum <- sum + x + + for name, _i in f do + System.Console.Write name + + let! x = ret 1 + sum <- sum + x + + return sum +} + +if (one [ ("", "", 1); ("", "", 2) ]).Result <> 8 then + failwith "unexpected result one" +if (one []).Result <> 2 then + failwith "unexpected result one" +if (two [ ("", "", 2) ]).Result <> 4 then + failwith "unexpected result two" +if (three [ ("", "", 5) ]).Result <> 6 then + failwith "unexpected result three" +if (four [ ("", 10) ]).Result <> 6 then + failwith "unexpected result four" +""" + |> withOptimize + |> compileExeAndRun + |> shouldSucceed + + From 3491f3a186d2388bcae5f6938cd9f21d4e557ae2 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Tue, 17 Feb 2026 10:53:47 +0100 Subject: [PATCH 10/43] add release notes --- docs/release-notes/.FSharp.Compiler.Service/10.0.300.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md index e7d1bd2e1bf..9e6b955c182 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md @@ -14,6 +14,7 @@ * Fix FS0229 B-stream misalignment when reading metadata from assemblies compiled with LangVersion < 9.0, introduced by [#17706](https://github.com/dotnet/fsharp/pull/17706). ([PR #19260](https://github.com/dotnet/fsharp/pull/19260)) * Fix FS3356 false positive for instance extension members with same name on different types, introduced by [#18821](https://github.com/dotnet/fsharp/pull/18821). ([PR #19260](https://github.com/dotnet/fsharp/pull/19260)) * F# Scripts: Fix default reference paths resolving when an SDK directory is specified. ([PR #19270](https://github.com/dotnet/fsharp/pull/19270)) +* Improve static compilation of state machines. ([PR #19297](https://github.com/dotnet/fsharp/pull/19297)) ### Added From 273e3cf3d2c30308b3b91660b9fe49e98ea13e67 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Tue, 17 Feb 2026 20:25:53 +0100 Subject: [PATCH 11/43] add more repros to tests --- .../Language/StateMachineTests.fs | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index d5095dc7625..f7d2ebb906c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -246,6 +246,93 @@ let test = task { |> compile |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + // see https://github.com/dotnet/fsharp/pull/14930#issuecomment-1528981395 + [] + let ``Task with some anonymous records`` () = + FSharp """ +module TestStateMachine +let bad () = task { + let res = {| ResultSet2 = [| {| im = Some 1; lc = 3 |} |] |} + + match [| |] with + | [| |] -> + let c = res.ResultSet2 |> Array.map (fun x -> {| Name = x.lc |}) + let c = res.ResultSet2 |> Array.map (fun x -> {| Name = x.lc |}) + let c = res.ResultSet2 |> Array.map (fun x -> {| Name = x.lc |}) + return Some c + | _ -> + return None +} +""" + |> compile + |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + + + + // repro of https://github.com/dotnet/fsharp/issues/12839 + [] + let ``Big record`` () = + FSharp """ +module TestStateMachine +type Foo = { X: int option } + +type BigRecord = + { + a1: string + a2: string + a3: string + a4: string + a5: string + a6: string + a7: string + a8: string + a9: string + a10: string + a11: string + a12: string + a13: string + a14: string + a15: string + a16: string + a17: string + a18: string + a19: string + a20: string + a21: string + a22: string + a23: string + a24: string + a25: string + a26: string + a27: string + a28: string + a29: string + a30: string + a31: string + a32: string + a33: string + a34: string + a35: string + a36: string // no warning if at least one field removed + + a37Optional: string option + } + +let testStateMachine (bigRecord: BigRecord) = + task { + match Some 5 with // no warn if this match removed and only inner one kept + | Some _ -> + match Unchecked.defaultof.X with // no warning if replaced with `match Some 5 with` + | Some _ -> + let d = { bigRecord with a37Optional = None } // no warning if d renamed as _ or ignore function used + () + | None -> () + | _ -> () + } +""" + |> compile + |> verifyIL [ ".override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext" ] + [] // https://github.com/dotnet/fsharp/issues/12839#issuecomment-1292310944 let ``Tasks with a for loop over tuples are statically compilable``() = From 98e472709439f7bc23d100ce46d263f9fd34572b Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 19 Feb 2026 09:39:49 +0100 Subject: [PATCH 12/43] remove catch all 3511 nowarns --- src/FSharp.Core/FSharp.Core.fsproj | 2 -- .../FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs | 5 ++++- vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs | 1 - .../src/FSharp.Editor/CodeFixes/ImplementInterface.fs | 4 ++-- .../tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj | 1 - 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj index 688ba098645..cad8ee1c930 100644 --- a/src/FSharp.Core/FSharp.Core.fsproj +++ b/src/FSharp.Core/FSharp.Core.fsproj @@ -18,8 +18,6 @@ $(OtherFlags) --warnon:3520 $(OtherFlags) --nowarn:57 - - $(OtherFlags) --nowarn:3511 $(OtherFlags) --nowarn:3513 $(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs index 430b1b526e4..7f9eaef3890 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs @@ -17,7 +17,6 @@ namespace FSharp.Core.UnitTests.Control.TasksDynamic #nowarn "1204" // construct only for use in compiled code -#nowarn "3511" // state machine not statically compilable - the one in 'Run' open System open System.Collections open System.Collections.Generic @@ -33,7 +32,9 @@ open System.Runtime.CompilerServices type TaskBuilderDynamic() = [] + #nowarn 3511 member _.Run(code) = task.Run(code) // warning 3511 is generated here: state machine not compilable + #warnon 3511 member inline _.Delay f = task.Delay(f) [] @@ -55,7 +56,9 @@ type TaskBuilderDynamic() = type BackgroundTaskBuilderDynamic() = [] + #nowarn 3511 member _.Run(code) = backgroundTask.Run(code) // warning 3511 is generated here: state machine not compilable + #warnon 3511 member inline _.Delay f = backgroundTask.Delay(f) [] diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs index e703fb648ac..ce646f98f25 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs @@ -139,7 +139,6 @@ module internal CodeFixExtensions = // This cannot be an extension on the code fix context // because the underlying GetFixAllProvider method doesn't take the context in. -#nowarn "3511" // state machine not statically compilable [] module IFSharpCodeFixProviderExtensions = diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index 1805428b8d7..52e04a0ce06 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -30,9 +30,7 @@ type internal InterfaceState = Tokens: Tokenizer.SavedTokenInfo[] } -// state machine not statically compilable // TODO: rewrite token arithmetics properly here -#nowarn "3511" [] type internal ImplementInterfaceCodeFixProvider [] () = @@ -173,6 +171,7 @@ type internal ImplementInterfaceCodeFixProvider [] () = interface IFSharpMultiCodeFixProvider with member _.GetCodeFixesAsync context = + #nowarn 3511 // let rec in state machine cancellableTask { let! cancellationToken = CancellableTask.getCancellationToken () @@ -289,3 +288,4 @@ type internal ImplementInterfaceCodeFixProvider [] () = ) | _ -> return Seq.empty } + #warnon 3511 diff --git a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj index 1625be60b9a..826cc53ac0d 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj +++ b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj @@ -6,7 +6,6 @@ false false true - $(NoWarn);FS3511 true From 7a0418aab77b90937b22a0f0a50a671c41192e0f Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 19 Feb 2026 09:57:45 +0100 Subject: [PATCH 13/43] fix handling outer expandVars ("The resumable code value(s) 'code' does not have a definition.") consider a Run(code: ResumableCode<...>) method. In some cases code can get optimized away resulting in warning 3511 "The resumable code value(s) 'code' does not have a definition." --- src/Compiler/CodeGen/IlxGen.fs | 20 +++++++++++++++++++- src/Compiler/Optimize/LowerStateMachines.fs | 14 ++++++++------ src/Compiler/Optimize/LowerStateMachines.fsi | 4 +++- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 1e2f26b011e..290bba23e4d 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -1261,6 +1261,11 @@ and IlxGenEnv = intraAssemblyInfo: IlxGenIntraAssemblyInfo realsig: bool + + /// Expression definitions of variables returning resumable code from outer scopes. + /// Used by state machine lowering to resolve otherwise-free expand variables + /// when the state machine is inside a lambda whose outer let-binding provides the definition. + resumableCodeDefinitions: ValMap } override _.ToString() = "" @@ -3004,7 +3009,9 @@ and GenExprPreSteps (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr sequel = true | None -> - match LowerStateMachineExpr cenv.g expr with + let smResult = LowerStateMachineExpr cenv.g eenv.resumableCodeDefinitions expr + + match smResult with | LoweredStateMachineResult.Lowered res -> let eenv = RemoveTemplateReplacement eenv checkLanguageFeatureError cenv.g.langVersion LanguageFeature.ResumableStateMachines expr.Range @@ -3499,6 +3506,16 @@ and GenLinearExpr cenv cgbuf eenv expr sequel preSteps (contf: FakeUnit -> FakeU GenDebugPointForBind cenv cgbuf bind GenBindingAfterDebugPoint cenv cgbuf eenv bind false (Some startMark) + // Track expand-var (resumable code) definitions so state machine lowering + // inside nested lambdas can resolve otherwise-free expand variables. + let eenv = + if isReturnsResumableCodeTy cenv.g bind.Var.TauType then + { eenv with + resumableCodeDefinitions = eenv.resumableCodeDefinitions.Add bind.Var bind.Expr + } + else + eenv + // Generate the body GenLinearExpr cenv cgbuf eenv body (EndLocalScope(sequel, endMark)) true contf @@ -12048,6 +12065,7 @@ let GetEmptyIlxGenEnv (g: TcGlobals) ccu = intraAssemblyInfo = IlxGenIntraAssemblyInfo.Create() realsig = g.realsig initClassFieldSpec = None + resumableCodeDefinitions = ValMap<_>.Empty } type IlxGenResults = diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 5d0bcad002f..2c5dea5ff07 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -167,7 +167,7 @@ type LoweredStateMachineResult = | NotAStateMachine /// Used to scope the action of lowering a state machine expression -type LowerStateMachine(g: TcGlobals) = +type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = let mutable pcCount = 0 let genPC() = @@ -409,7 +409,9 @@ type LowerStateMachine(g: TcGlobals) = [] let (|ExpandedStateMachineInContext|_|) inputExpr = // All expanded resumable code state machines e.g. 'task { .. }' begin with a bind of @builder or 'defn' - let env, expr = BindResumableCodeDefinitions env.Empty inputExpr + // Seed the env with any expand-var definitions from outer scopes (e.g. across lambda boundaries) + let initialEnv = { env.Empty with ResumableCodeDefns = outerResumableCodeDefns } + let env, expr = BindResumableCodeDefinitions initialEnv inputExpr match expr with | StructStateMachineExpr g (dataTy, @@ -892,8 +894,8 @@ type LowerStateMachine(g: TcGlobals) = let env, codeExprR = RepeatBindAndApplyOuterDefinitions env codeExpr let frees = (freeInExpr CollectLocals overallExpr).FreeLocals - if frees |> Zset.exists (isExpandVar g) then - let nonfree = frees |> Zset.elements |> List.filter (isExpandVar g) |> List.map (fun v -> v.DisplayName) |> String.concat "," + if frees |> Zset.exists (fun v -> isExpandVar g v && not (env.ResumableCodeDefns.ContainsVal v)) then + let nonfree = frees |> Zset.elements |> List.filter (fun v -> isExpandVar g v && not (env.ResumableCodeDefns.ContainsVal v)) |> List.map (fun v -> v.DisplayName) |> String.concat "," let msg = FSComp.SR.reprResumableCodeValueHasNoDefinition(nonfree) fallback msg else @@ -947,7 +949,7 @@ type LowerStateMachine(g: TcGlobals) = let msg = FSComp.SR.reprStateMachineInvalidForm() fallback msg -let LowerStateMachineExpr g (overallExpr: Expr) : LoweredStateMachineResult = +let LowerStateMachineExpr g (outerResumableCodeDefns: ValMap) (overallExpr: Expr) : LoweredStateMachineResult = // Detect a state machine and convert it let stateMachine = IsStateMachineExpr g overallExpr @@ -955,4 +957,4 @@ let LowerStateMachineExpr g (overallExpr: Expr) : LoweredStateMachineResult = | None -> LoweredStateMachineResult.NotAStateMachine | Some altExprOpt -> - LowerStateMachine(g).Apply(overallExpr, altExprOpt) + LowerStateMachine(g, outerResumableCodeDefns).Apply(overallExpr, altExprOpt) diff --git a/src/Compiler/Optimize/LowerStateMachines.fsi b/src/Compiler/Optimize/LowerStateMachines.fsi index 4ee177174e2..814b7a45d14 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fsi +++ b/src/Compiler/Optimize/LowerStateMachines.fsi @@ -3,6 +3,7 @@ module internal FSharp.Compiler.LowerStateMachines open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TcGlobals type LoweredStateMachine = @@ -30,4 +31,5 @@ type LoweredStateMachineResult = /// Analyze a TAST expression to detect the elaborated form of a state machine expression, a special kind /// of object expression that uses special code generation constructs. -val LowerStateMachineExpr: g: TcGlobals -> overallExpr: Expr -> LoweredStateMachineResult +val LowerStateMachineExpr: + g: TcGlobals -> outerResumableCodeDefns: ValMap -> overallExpr: Expr -> LoweredStateMachineResult From d477745b63c33aea057ee50caa34d633e1d6d693 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 19 Feb 2026 09:58:21 +0100 Subject: [PATCH 14/43] fix double wrapped Delay in CancellableTask --- .../src/FSharp.Editor/Common/CancellableTasks.fs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs b/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs index 4299936d05a..5056ddee461 100644 --- a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs +++ b/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs @@ -123,11 +123,9 @@ module CancellableTasks = member inline _.Delay ([] generator: unit -> CancellableTaskCode<'TOverall, 'T>) : CancellableTaskCode<'TOverall, 'T> = - ResumableCode.Delay(fun () -> - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - (generator ()).Invoke(&sm) - ) + CancellableTaskCode(fun sm -> + sm.Data.ThrowIfCancellationRequested() + (generator ()).Invoke(&sm) ) From ba1d9a5c74ac7e92631272a8aa0e0cb5b2df0abb Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:20:48 +0100 Subject: [PATCH 15/43] fix fantomas --- .../src/FSharp.Editor/CodeFixes/ImplementInterface.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index 52e04a0ce06..92f0c0077d7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -31,6 +31,8 @@ type internal InterfaceState = } // TODO: rewrite token arithmetics properly here +// state machine not statically compilable (let rec in state machine) +#nowarn "3511" [] type internal ImplementInterfaceCodeFixProvider [] () = @@ -171,7 +173,6 @@ type internal ImplementInterfaceCodeFixProvider [] () = interface IFSharpMultiCodeFixProvider with member _.GetCodeFixesAsync context = - #nowarn 3511 // let rec in state machine cancellableTask { let! cancellationToken = CancellableTask.getCancellationToken () @@ -288,4 +289,3 @@ type internal ImplementInterfaceCodeFixProvider [] () = ) | _ -> return Seq.empty } - #warnon 3511 From 8c45c13d3942b2382f9dac43ba4cf69d171cbe25 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:24:12 +0100 Subject: [PATCH 16/43] release notes --- docs/release-notes/.VisualStudio/18.vNext.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.VisualStudio/18.vNext.md b/docs/release-notes/.VisualStudio/18.vNext.md index 587f3e8bad0..7131fc8e418 100644 --- a/docs/release-notes/.VisualStudio/18.vNext.md +++ b/docs/release-notes/.VisualStudio/18.vNext.md @@ -3,5 +3,6 @@ * Fixed Rename incorrectly renaming `get` and `set` keywords for properties with explicit accessors. ([Issue #18270](https://github.com/dotnet/fsharp/issues/18270), [PR #19252](https://github.com/dotnet/fsharp/pull/19252)) * Fixed Find All References crash when F# project contains non-F# files like `.cshtml`. ([Issue #16394](https://github.com/dotnet/fsharp/issues/16394), [PR #19252](https://github.com/dotnet/fsharp/pull/19252)) * Find All References for external DLL symbols now only searches projects that reference the specific assembly. ([Issue #10227](https://github.com/dotnet/fsharp/issues/10227), [PR #19252](https://github.com/dotnet/fsharp/pull/19252)) +* Improve static compilation of state machines. ([PR #19297](https://github.com/dotnet/fsharp/pull/19297)) ### Changed From 9c9b186fc756e39a3b41b97fe1b5a40b13aba594 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Sat, 21 Feb 2026 13:03:43 +0100 Subject: [PATCH 17/43] remove v2 remnants, add deterministic init via assembly fixture --- .../FSharp.Test.Utilities.fsproj | 3 +- tests/FSharp.Test.Utilities/XunitHelpers.fs | 260 ------------------ tests/FSharp.Test.Utilities/XunitSetup.fs | 40 +-- 3 files changed, 21 insertions(+), 282 deletions(-) delete mode 100644 tests/FSharp.Test.Utilities/XunitHelpers.fs diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 83efe58a14a..5863adc77ea 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -42,7 +42,6 @@ - @@ -104,7 +103,7 @@ - + diff --git a/tests/FSharp.Test.Utilities/XunitHelpers.fs b/tests/FSharp.Test.Utilities/XunitHelpers.fs deleted file mode 100644 index e74e8c38f71..00000000000 --- a/tests/FSharp.Test.Utilities/XunitHelpers.fs +++ /dev/null @@ -1,260 +0,0 @@ -#if XUNIT_EXTRAS -#nowarn "0044" -#endif - -namespace FSharp.Test - -open System -open System.Reflection -open System.Threading.Tasks -open Xunit.Sdk -open Xunit.v3 - -open TestFramework - -open FSharp.Compiler.Caches -open FSharp.Compiler.Diagnostics - -open OpenTelemetry.Resources -open OpenTelemetry.Trace -open OpenTelemetry.Metrics - -/// Disables custom internal parallelization added with XUNIT_EXTRAS. -/// Execute test cases in a class or a module one by one instead of all at once. Allow other collections to run simultaneously. -[] -type RunTestCasesInSequenceAttribute() = inherit Attribute() - -// Helper for stress testing. -// Runs a test case many times in parallel. -// Example usage: [] -type StressAttribute([] data: obj array) = - inherit DataAttributeBase() - member val Count = 1 with get, set - override this.GetData(_testMethod: MethodInfo, _disposalTracker: DisposalTracker) = - let results = Seq.init this.Count (fun i -> [| yield! data; yield box i |]) - DataAttributeBase.WrapRows(results) - -#if XUNIT_EXTRAS - -// To use xUnit means to customize it. The following features are added: -// - Internally parallelize test classes and theories. Test cases and theory cases included in a single class or F# module can execute simultaneously -// - Add batch traits for CI multi-agent testing support -// Note: Console output capturing is now handled by xUnit3's built-in [] attribute - -module TestCaseCustomizations = - // Internally parallelize test classes and theories. - // Based on https://www.meziantou.net/parallelize-test-cases-execution-in-xunit.htm - // The trick is to assign a unique test collection to each case. - // Since test collection is xUnit's unit of parallelization, it will execute everything in parallel including theory cases. - let rewriteTestMethod (testCase: ITestCase) : ITestMethod = - let canFullyParallelize = - // does not belong to a defined collection - isNull testCase.TestMethod.TestClass.TestCollection.CollectionDefinition - && testCase.TestMethod.TestClass.Class.GetCustomAttributes(typeof) |> Seq.isEmpty - // is not marked with `[]` attribute - && testCase.TestMethod.Method.GetCustomAttributes(typeof) |> Seq.isEmpty - && testCase.TestMethod.TestClass.Class.GetCustomAttributes(typeof) |> Seq.isEmpty - - if canFullyParallelize then - let oldTestMethod = testCase.TestMethod - let oldTestClass = oldTestMethod.TestClass - let oldTestCollection = oldTestMethod.TestClass.TestCollection - - // Create a DETERMINISTIC collection ID based on the test case's unique ID - // This ensures the same test case always gets the same collection ID - let collectionId = - use sha = System.Security.Cryptography.SHA256.Create() - let bytes = System.Text.Encoding.UTF8.GetBytes(testCase.UniqueID) - let hash = sha.ComputeHash(bytes) - System.Guid(hash.[0..15]) // Take first 16 bytes for GUID - - let newDisplayName = $"{oldTestCollection.DisplayName}_{collectionId:N}" - - // Create a new collection with a unique id for the test case. - let newTestCollection = - new TestCollection( - oldTestCollection.TestAssembly, - oldTestCollection.CollectionDefinition, - newDisplayName, - collectionId - ) - - let newTestClass = new TestClass(newTestCollection, oldTestClass.Class) - TestMethod(newTestClass, oldTestMethod.Method) - else - testCase.TestMethod - - let sha = Security.Cryptography.SHA256.Create() - - // We add extra trait to each test, of the form "batch=n" where n is between 1 and 4. - // It can be used to filter on in multi-agent testing in CI - // with dotnet test filter switch, for example "-- --filter-trait batch=1" - // That way each agent can run test for a batch of tests. - let NumberOfBatchesInMultiAgentTesting = 4u - - let addBatchTrait (testCase: ITestCase) = - // Get a batch number stable between multiple test runs. - // UniqueID is ideal here, it does not change across many compilations of the same code - // and it will split theories with member data into many batches. - let data = Text.Encoding.UTF8.GetBytes testCase.UniqueID - let hashCode = BitConverter.ToUInt32(sha.ComputeHash(data), 0) - let batch = hashCode % NumberOfBatchesInMultiAgentTesting + 1u - testCase.Traits.Add("batch", ResizeArray [ string batch ]) - -type CustomTestCase = - inherit XunitTestCase - // xUnit demands this constructor for deserialization. - new() = { inherit XunitTestCase() } - - new(sink: IMessageSink, md, mdo, testMethod, testMethodArgs) = { inherit XunitTestCase(sink, md, mdo, testMethod, testMethodArgs) } - - // Initialize is ensured by xUnit to run once before any property access. - override testCase.Initialize () = - base.Initialize() - testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase - TestCaseCustomizations.addBatchTrait testCase - -type CustomTheoryTestCase = - inherit XunitTheoryTestCase - new() = { inherit XunitTheoryTestCase() } - - new(sink: IMessageSink, md, mdo, testMethod) = { inherit XunitTheoryTestCase(sink, md, mdo, testMethod) } - - override testCase.Initialize () = - base.Initialize() - testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase - TestCaseCustomizations.addBatchTrait testCase - -#endif - - -type OpenTelemetryExport(testRunName, enable) = - // On Windows forwarding localhost to wsl2 docker container sometimes does not work. Use IP address instead. - let otlpEndpoint = Uri("http://127.0.0.1:4317") - - // Configure OpenTelemetry export. - let providers : IDisposable list = - if not enable then [] else - [ - // Configure OpenTelemetry tracing export. Traces can be viewed in Jaeger or other compatible tools. - OpenTelemetry.Sdk.CreateTracerProviderBuilder() - .AddSource(ActivityNames.FscSourceName) - .ConfigureResource(fun r -> r.AddService("F#") |> ignore) - .AddOtlpExporter(fun o -> - o.Endpoint <- otlpEndpoint - o.Protocol <- OpenTelemetry.Exporter.OtlpExportProtocol.Grpc - // Empirical values to ensure no traces are lost and no significant delay at the end of test run. - o.TimeoutMilliseconds <- 200 - o.BatchExportProcessorOptions.MaxQueueSize <- 16384 - o.BatchExportProcessorOptions.ScheduledDelayMilliseconds <- 100 - ) - .Build() - - // Configure OpenTelemetry metrics export. Metrics can be viewed in Prometheus or other compatible tools. - OpenTelemetry.Sdk.CreateMeterProviderBuilder() - .AddMeter(ActivityNames.FscSourceName) - .AddMeter("System.Runtime") - .ConfigureResource(fun r -> r.AddService(testRunName) |> ignore) - .AddOtlpExporter(fun e m -> - e.Endpoint <- otlpEndpoint - e.Protocol <- OpenTelemetry.Exporter.OtlpExportProtocol.Grpc - m.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds <- 1000 - ) - .Build() - ] - - interface IDisposable with - member this.Dispose() = - for p in providers do p.Dispose() - -// In some situations, VS can invoke CreateExecutor and RunTestCases many times during testhost lifetime. -// For example when executing "run until failure" command in Test Explorer. -// However, we want to ensure that OneTimeSetup is called only once per test run. -module OneTimeSetup = - - let init = - lazy - #if !NETCOREAPP - // We need AssemblyResolver already here, because OpenTelemetry loads some assemblies dynamically. - log "Adding AssemblyResolver" - AssemblyResolver.addResolver () - #endif - log $"Server GC enabled: {System.Runtime.GCSettings.IsServerGC}" - log "Installing TestConsole redirection" - TestConsole.install() - - logConfig initialConfig - - let EnsureInitialized() = - // Ensure that the initialization is done only once per test run. - init.Force() - -/// `XunitTestFramework` providing parallel console support and conditionally enabling optional xUnit customizations. -/// NOTE: Temporarily disabled due to xUnit3 API incompatibilities -/// TODO: Reimplement for xUnit3 if OneTimeSetup, OpenTelemetry, or cleanup functionality is needed -(* -type FSharpXunitFramework(sink: IMessageSink) = - inherit XunitTestFramework(sink) - - do OneTimeSetup.EnsureInitialized() - - override this.CreateExecutor (assemblyName) = - { new XunitTestFrameworkExecutor(assemblyName, this.SourceInformationProvider, this.DiagnosticMessageSink) with - - // Because xUnit v2 lacks assembly fixture, this is a good place to ensure things get called right at the start of the test run. - override x.RunTestCases(testCases, executionMessageSink, executionOptions) = - - let testRunName = $"RunTests_{assemblyName.Name} {Runtime.InteropServices.RuntimeInformation.FrameworkDescription}" - - use _ = new OpenTelemetryExport(testRunName, Environment.GetEnvironmentVariable("FSHARP_OTEL_EXPORT") <> null) - - begin - use _ = Activity.startNoTags testRunName - // We can't just call base.RunTestCases here, because it's implementation is async void. - use runner = new XunitTestAssemblyRunner (x.TestAssembly, testCases, x.DiagnosticMessageSink, executionMessageSink, executionOptions) - runner.RunAsync().Wait() - end - - cleanUpTemporaryDirectoryOfThisTestRun () - } -*) - -#if XUNIT_EXTRAS - // Rewrites discovered test cases to support extra parallelization and batch trait injection. - override this.CreateDiscoverer (assemblyInfo) = - { new XunitTestFrameworkDiscoverer(assemblyInfo, this.SourceInformationProvider, this.DiagnosticMessageSink) with - override _.FindTestsForType (testClass, includeSourceInformation, messageBus, options) = - // Intercepts test discovery messages to augment test cases with additional capabilities. - let customizingBus = - { new IMessageBus with - member _.QueueMessage (message: IMessageSinkMessage) = - match message with - | :? ITestCaseDiscoveryMessage as discoveryMessage -> - let customized: ITestCase = - match discoveryMessage.TestCase with - | :? XunitTheoryTestCase -> - new CustomTheoryTestCase( - sink, - options.MethodDisplayOrDefault(), - options.MethodDisplayOptionsOrDefault(), - discoveryMessage.TestCase.TestMethod, - SourceInformation = discoveryMessage.TestCase.SourceInformation - ) - | :? XunitTestCase -> - new CustomTestCase( - sink, - options.MethodDisplayOrDefault(), - options.MethodDisplayOptionsOrDefault(), - discoveryMessage.TestCase.TestMethod, - discoveryMessage.TestCase.TestMethodArguments, - SourceInformation = discoveryMessage.TestCase.SourceInformation - ) - | testCase -> testCase - messageBus.QueueMessage(TestCaseDiscoveryMessage customized) - | _ -> - messageBus.QueueMessage message - member _.Dispose () = messageBus.Dispose() } - base.FindTestsForType(testClass, includeSourceInformation, customizingBus, options) - } - -#endif diff --git a/tests/FSharp.Test.Utilities/XunitSetup.fs b/tests/FSharp.Test.Utilities/XunitSetup.fs index 93d2b09121e..792615e0267 100644 --- a/tests/FSharp.Test.Utilities/XunitSetup.fs +++ b/tests/FSharp.Test.Utilities/XunitSetup.fs @@ -1,40 +1,40 @@ namespace FSharp.Test +open System open Xunit +open TestFramework -// xUnit3 assembly fixtures: ensure TestConsole is installed once per assembly -// This replaces the OneTimeSetup.EnsureInitialized() call that was done in FSharpXunitFramework -module private XUnitInit = - let private ensureInitialized = lazy ( +/// xUnit3 assembly fixture: performs one-time setup for the test assembly. +/// Registered via [)>] below. +/// The constructor is called by xUnit once before any tests in the assembly run. +type FSharpTestAssemblyFixture() = + do #if !NETCOREAPP - // On .NET Framework, we need the assembly resolver for finding assemblies - // that might be in different locations (e.g., when FSI loads assemblies) + // We need AssemblyResolver already here, because OpenTelemetry loads some assemblies dynamically. + log "Adding AssemblyResolver" AssemblyResolver.addResolver() #endif + log $"Server GC enabled: {Runtime.GCSettings.IsServerGC}" + log "Installing TestConsole redirection" TestConsole.install() - ) - - /// Call this to ensure TestConsole is installed. Safe to call multiple times. - let initialize() = ensureInitialized.Force() + logConfig initialConfig /// Exclude from parallelization. Execute test cases in sequence and do not run any other collections at the same time. /// see https://github.com/xunit/xunit/issues/1999#issuecomment-522635397 [] type NotThreadSafeResourceCollection() = class end +/// Mark test cases as not safe to run in parallel with other test cases of the same test collection. +/// In case Xunit 3 enables internal parallelization of test collections. +[] +type RunTestCasesInSequenceAttribute() = inherit Attribute() + module XUnitSetup = - // NOTE: Custom TestFramework temporarily disabled due to xUnit3 API incompatibilities - // TODO: Reimplement FSharpXunitFramework for xUnit3 if needed - // [] - // NOTE: CaptureTrace is disabled because it conflicts with TestConsole.ExecutionCapture // which is used by FSI tests to capture console output. xUnit3's trace capture intercepts // console output before it can reach TestConsole's redirectors. // [] - - /// Call this to ensure TestConsole is installed. Safe to call multiple times. - let initialize() = XUnitInit.initialize() - - // Force initialization when module is loaded - do initialize() + + [)>] + do () From b38554eb1199a61d928e3b50558c71c119787ea8 Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Sun, 22 Feb 2026 12:11:37 +0100 Subject: [PATCH 18/43] remove warning --- src/Compiler/Checking/CheckDeclarations.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 1aeaa83d302..eac8bfbadc0 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -4875,7 +4875,6 @@ module TcDeclarations = //------------------------------------------------------------------------- // Bind module types //------------------------------------------------------------------------- -#nowarn 3511 let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcEnv) synSigDecl: Async2 = async2 { let g = cenv.g From d466a8765b8c5dabf1adb1b2aac733c2412253a3 Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Sun, 22 Feb 2026 13:21:50 +0100 Subject: [PATCH 19/43] add simple MailboxProcessor --- src/Compiler/FSharp.Compiler.Service.fsproj | 2 +- src/Compiler/Utilities/Activity.fs | 6 +- src/Compiler/Utilities/Async2.fs | 68 ++++++++++++++++++--- src/Compiler/Utilities/Caches.fs | 22 +++---- 4 files changed, 71 insertions(+), 27 deletions(-) diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index cefc4c398a8..875fc64e67e 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -102,6 +102,7 @@ + FSComp.txt @@ -130,7 +131,6 @@ - diff --git a/src/Compiler/Utilities/Activity.fs b/src/Compiler/Utilities/Activity.fs index 8e2fe428815..e0843a67070 100644 --- a/src/Compiler/Utilities/Activity.fs +++ b/src/Compiler/Utilities/Activity.fs @@ -308,11 +308,11 @@ module internal Activity = let sw = new StreamWriter(path = pathToFile, append = true) let msgQueue = - MailboxProcessor.Start(fun inbox -> - async { + MailboxProcessor2.Start(fun inbox -> + async2 { while true do let! msg = inbox.Receive() - do! sw.WriteLineAsync(msg) |> Async.AwaitTask + do! sw.WriteLineAsync(msg) }) let l = diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 1c89f8854ac..07b8f0ebc3f 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -1,6 +1,7 @@ namespace Internal.Utilities.Library open System +open System.Collections.Concurrent open System.Threading open System.Threading.Tasks open System.Runtime.CompilerServices @@ -306,11 +307,7 @@ module Async2Implementation = Immediate state let resumptionInfo awaited = - let initialState = - if awaited then - maybeBounce Running - else - Immediate Running + let initialState = if awaited then maybeBounce Running else Immediate Running { new Async2ResumptionDynamicInfo<'T>(initialResumptionFunc, ResumptionData = initialState) with member info.MoveNext(sm) = @@ -404,8 +401,7 @@ open Async2Implementation module LowPriority = type Async2Builder with [] - member inline this.Bind(awaitable, [] continuation) = - bindAwaitable (awaitable, continuation) + member inline this.Bind(awaitable, [] continuation) = bindAwaitable (awaitable, continuation) [] member inline this.ReturnFrom(awaitable) = this.Bind(awaitable, this.Return) @@ -531,7 +527,8 @@ type Async2 = async2 { let! ct = Async2.CancellationToken use lcts = CancellationTokenSource.CreateLinkedTokenSource ct - try + + try let tasks = computations |> Seq.map (Async2.startInThreadPool lcts.Token) return! Task.WhenAll tasks with exn -> @@ -604,3 +601,58 @@ type Async2 = finally handle.Unregister(waitHandle) |> ignore } + +/// An async2-native message processing agent, analogous to MailboxProcessor but using Async2. +[] +type MailboxProcessor2<'Msg> private (body: MailboxProcessor2<'Msg> -> Async2, cts: CancellationTokenSource) = + + let queue = ConcurrentQueue<'Msg>() + let semaphore = new SemaphoreSlim(0) + let errorEvent = Event() + + /// Post a message to the agent's mailbox. + member _.Post(msg: 'Msg) = + queue.Enqueue(msg) + semaphore.Release() |> ignore + + /// Receive the next message from the mailbox, suspending until one arrives. + member _.Receive() : Async2<'Msg> = + async2 { + let! ct = Async2.CancellationToken + do! semaphore.WaitAsync(ct) + + match queue.TryDequeue() with + | true, msg -> return msg + | _ -> return failwith "MailboxProcessor2: queue unexpectedly empty after semaphore signal" + } + + [] + member _.Error = errorEvent.Publish + + member private this.StartBody() = + Async2.Start( + async2 { + try + do! body this + with exn -> + errorEvent.Trigger exn + }, + cts.Token + ) + + member _.Dispose() = + cts.Cancel() + cts.Dispose() + + interface IDisposable with + member this.Dispose() = this.Dispose() + + static member Start(body: MailboxProcessor2<'Msg> -> Async2, ?cancellationToken: CancellationToken) = + let cts = + match cancellationToken with + | Some ct -> CancellationTokenSource.CreateLinkedTokenSource(ct) + | None -> new CancellationTokenSource() + + let mbp = new MailboxProcessor2<'Msg>(body, cts) + mbp.StartBody() + mbp diff --git a/src/Compiler/Utilities/Caches.fs b/src/Compiler/Utilities/Caches.fs index fb024844e09..d8009718b42 100644 --- a/src/Compiler/Utilities/Caches.fs +++ b/src/Compiler/Utilities/Caches.fs @@ -7,6 +7,7 @@ open System.Collections.Concurrent open System.Threading open System.Diagnostics open System.Diagnostics.Metrics +open Internal.Utilities.Library module CacheMetrics = let Meter = FSharp.Compiler.Diagnostics.Metrics.Meter @@ -329,16 +330,13 @@ type Cache<'Key, 'Value when 'Key: not null> internal (options: CacheOptions<'Ke | _ -> () let startEvictionProcessor ct = - MailboxProcessor.Start( + MailboxProcessor2.Start( (fun mb -> - let rec processNext () = - async { + async2 { + while true do let! message = mb.Receive() processEvictionMessage message - return! processNext () - } - - processNext ()), + }), ct ) @@ -350,15 +348,9 @@ type Cache<'Key, 'Value when 'Key: not null> internal (options: CacheOptions<'Ke | EvictionMode.NoEviction -> ignore, ignore | EvictionMode.Immediate -> immediate, ignore | EvictionMode.MailboxProcessor -> - let cts = new CancellationTokenSource() - let evictionProcessor = startEvictionProcessor cts.Token + let evictionProcessor = startEvictionProcessor CancellationToken.None let post = evictionProcessor.Post - - let dispose () = - cts.Cancel() - cts.Dispose() - evictionProcessor.Dispose() - + let dispose () = evictionProcessor.Dispose() post, dispose #if DEBUG From 84783c8f12d4f2d005ff1d590e997df1a751e4d9 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:12:11 +0100 Subject: [PATCH 20/43] state-machine tests: bind tasks as top level values --- tests/fsharp/core/state-machines/test.fsx | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/fsharp/core/state-machines/test.fsx b/tests/fsharp/core/state-machines/test.fsx index 7e502839d6d..3152cf2c41c 100644 --- a/tests/fsharp/core/state-machines/test.fsx +++ b/tests/fsharp/core/state-machines/test.fsx @@ -484,17 +484,17 @@ let inline checkStateMachine nm = // These simply detect state machine compilation module ``Check simple task compiles to state machine`` = - let test1() = + let test1 = task { checkStateMachine "vevroerhn11" return 1 } - test1().Wait() + test1.Wait() module ``Check simple task with bind compiles to state machine`` = - let test2() = + let test2 = task { checkStateMachine "vevroerhn12" @@ -503,14 +503,14 @@ module ``Check simple task with bind compiles to state machine`` = return 1 } - test2().Wait() + test2.Wait() module ``Check task with multiple bind doesn't cause code explosion from inlining and compiles to state machine`` = let syncTask() = Task.FromResult 100 - let tenBindSync_Task() = + let tenBindSync_Task = task { let! res1 = syncTask() checkStateMachine "vevroerhn121" @@ -535,10 +535,10 @@ module ``Check task with multiple bind doesn't cause code explosion from inlinin return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 } - tenBindSync_Task().Wait() + tenBindSync_Task.Wait() module ``Check task with try with compiles to state machine`` = - let t67() = + let t67 = task { checkStateMachine "vevroerhn180" try @@ -552,10 +552,10 @@ module ``Check task with try with compiles to state machine`` = () } - t67().Wait() + t67.Wait() module ``Check task with try with and incomplete match compiles to state machine`` = - let t68() = + let t68 = task { try checkStateMachine "vevroerhn190" @@ -566,10 +566,10 @@ module ``Check task with try with and incomplete match compiles to state machine () } - t68().Wait() + t68.Wait() module ``Check task with while loop with resumption points compiles to state machine`` = - let t68() : Task = + let t68 : Task = task { checkStateMachine "vevroerhn200" let mutable i = 0 @@ -582,10 +582,10 @@ module ``Check task with while loop with resumption points compiles to state mac return i } - t68().Wait() + t68.Wait() module ``Check task with try finally compiles to state machine`` = - let t68() = + let t68 = task { let mutable ran = false try @@ -598,10 +598,10 @@ module ``Check task with try finally compiles to state machine`` = return ran } - t68().Wait() + t68.Wait() module ``Check task with use compiles to state machine`` = - let t68() = + let t68 = task { let mutable disposed = false use d = { new System.IDisposable with member __.Dispose() = disposed <- true } @@ -610,10 +610,10 @@ module ``Check task with use compiles to state machine`` = checkStateMachine "vevroerhn221" } - t68().Wait() + t68.Wait() module ``Check nested task compiles to state machine`` = - let t68() = + let t68 = task { let mutable n = 0 checkStateMachine "vevroerhn230" @@ -628,7 +628,7 @@ module ``Check nested task compiles to state machine`` = n <- n + 1 } - t68().Wait() + t68.Wait() module ``Check after code may include closures`` = let makeStateMachine x = From 0b00548ac67f59721841e48f64e13e3867574e04 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 25 Feb 2026 20:29:12 +0100 Subject: [PATCH 21/43] . --- src/Compiler/Utilities/Caches.fs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Compiler/Utilities/Caches.fs b/src/Compiler/Utilities/Caches.fs index d8009718b42..8f6b4044375 100644 --- a/src/Compiler/Utilities/Caches.fs +++ b/src/Compiler/Utilities/Caches.fs @@ -353,10 +353,6 @@ type Cache<'Key, 'Value when 'Key: not null> internal (options: CacheOptions<'Ke let dispose () = evictionProcessor.Dispose() post, dispose -#if DEBUG - let debugListener = new CacheMetrics.CacheMetricsListener(tags) -#endif - do CacheMetrics.Created &tags member val Evicted = evicted.Publish @@ -437,7 +433,3 @@ type Cache<'Key, 'Value when 'Key: not null> internal (options: CacheOptions<'Ke // Finalizer to ensure eviction loop is cancelled if Dispose wasn't called. override this.Finalize() = this.Dispose() - -#if DEBUG - member _.DebugDisplay() = debugListener.ToString() -#endif From cca265a058a0c894fc15c392ea761866abb7a446 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 25 Feb 2026 22:32:07 +0100 Subject: [PATCH 22/43] fix AwaitWaitHandle --- src/Compiler/Utilities/Async2.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 07b8f0ebc3f..59ebf1c8add 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -599,7 +599,7 @@ type Async2 = try return! tcs.Task finally - handle.Unregister(waitHandle) |> ignore + handle.Unregister null |> ignore } /// An async2-native message processing agent, analogous to MailboxProcessor but using Async2. From 57cffe85579e5406a3b5156c783c97d662f5b861 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 26 Feb 2026 00:04:57 +0100 Subject: [PATCH 23/43] fix tests --- .../CompilerService/AsyncMemoize.fs | 335 ++++++++---------- ...iler.Service.SurfaceArea.netstandard20.bsl | 7 + 2 files changed, 148 insertions(+), 194 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index 256db2ab4b4..b7945347046 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -3,59 +3,54 @@ module CompilerService.AsyncMemoize open System open System.Threading open Internal.Utilities.Collections -open Internal.Utilities.Library open System.Threading.Tasks open System.Diagnostics open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.Diagnostics +open Internal.Utilities.Library open Xunit -let internal observe (cache: AsyncMemoize<_,_,_>) = - let collected = new MailboxProcessor<_>(fun _ -> async {}) +type FactWithTimeoutAttribute() = inherit FactAttribute(Timeout = 300_000) // 5 minutes for good measure. - let arrivals = MailboxProcessor.Start(fun inbox -> - let rec loop events = async { - let! (e, (_, k, _)) = inbox.Receive() - let events = (e, k) :: events - printfn $"{k}: {e}" - collected.Post events - do! loop events - } - loop [] - ) +let internal observe (cache: AsyncMemoize<_,_,_>) = - cache.Event.Add arrivals.Post + let events = System.Collections.Generic.List<_>() + let gate = new SemaphoreSlim(0) - let next () = collected.Receive() + cache.Event.Add(fun (e, (_, k, _)) -> + printfn $"{k}: {e}" + lock events (fun () -> events.Add((e, k))) + gate.Release() |> ignore + ) - next + let mutable position = 0 -let rec awaitEvents next condition = - async { - match! next () with - | events when condition events -> return events - | _ -> - do! Async.Sleep 1 - return! awaitEvents next condition - } + let expectEvent (expectedE, expectedK) = + let rec waitForPosition n = + async2 { + let count = lock events (fun () -> events.Count) -let rec eventsWhen next condition = - awaitEvents next condition |> Async.RunSynchronously + if count > n then + return () + else + do! gate.WaitAsync() + return! waitForPosition n + } -let waitUntil next condition = - eventsWhen next condition |> ignore + async2 { + let n = position + position <- position + 1 -let expect next (expected: 't list) = - let actual = eventsWhen next (List.length >> (=) expected.Length) - Assert.Equal<'t list>(expected, actual |> List.rev) + do! waitForPosition n -let countOf value events = - events |> Seq.filter (fst >> (=) value) |> Seq.length + let actual = lock events (fun () -> events[n]) + Assert.Equal((expectedE, expectedK), actual) + } -let received event = function (a, _) :: _ when a = event -> true | _ -> false + expectEvent let internal wrapKey key = { new ICacheKey<_, _> with @@ -65,11 +60,12 @@ let internal wrapKey key = } let assertTaskCanceled (task: Task<_>) = - Assert.ThrowsAnyAsync(fun () -> task).Result |> ignore + Assert.ThrowsAnyAsync(fun () -> task) :> Task + -let awaitHandle h = h |> Async.AwaitWaitHandle |> Async.Ignore +let awaitHandle h = h |> Async2.AwaitWaitHandle |> Async2.Ignore -[] +[] let ``Basics``() = let computation key = async2 { do! Async.Sleep 1 @@ -77,9 +73,8 @@ let ``Basics``() = } let memoize = AsyncMemoize() - let events = observe memoize - let result = + let gets = seq { memoize.Get(wrapKey 5, computation 5) memoize.Get(wrapKey 5, computation 5) @@ -88,21 +83,18 @@ let ``Basics``() = memoize.Get(wrapKey 3, computation 3) memoize.Get(wrapKey 2, computation 2) } - |> Async2.Parallel - |> Async2.RunImmediate - let expected = [| 10; 10; 4; 10; 6; 4|] + async2 { - Assert.Equal(expected, result) + let expected = [| 10; 10; 4; 10; 6; 4|] - let events = eventsWhen events (countOf Finished >> (=) 3) + let! result = gets |> Async2.Parallel - let groups = events |> Seq.groupBy snd |> Seq.toList - Assert.Equal(3, groups.Length) - for key, events in groups do - Assert.Equal>(Set [ Requested, key; Started, key; Finished, key ], Set events) + Assert.Equal(expected, result) + } + |> Async2.StartAsTask -[] +[] let ``We can disconnect a request from a running job`` () = let cts = new CancellationTokenSource() @@ -113,25 +105,26 @@ let ``We can disconnect a request from a running job`` () = } let memoize = AsyncMemoize<_, int, _>(cancelUnawaitedJobs = false) - let events = observe memoize + let expectEvent = observe memoize let key = 1 let task1 = Async2.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) - waitUntil events (received Started) - cts.Cancel() + async2 { + do! expectEvent (Requested, key) + do! expectEvent (Started, key) + cts.Cancel() - assertTaskCanceled task1 + do! assertTaskCanceled task1 - canFinish.Set() |> ignore + canFinish.Set() |> ignore - expect events - [ Requested, key - Started, key - Finished, key ] + do! expectEvent (Finished, key) + } + |> Async2.StartAsTask -[] +[] let ``We can cancel a job`` () = let cts = new CancellationTokenSource() @@ -142,24 +135,24 @@ let ``We can cancel a job`` () = } let memoize = AsyncMemoize<_, int, _>() - let events = observe memoize + let expectEvent = observe memoize let key = 1 let task1 = Async2.StartAsTask( memoize.Get(wrapKey 1, computation), cancellationToken = cts.Token) - waitUntil events (received Started) - - cts.Cancel() + async2 { + do! expectEvent (Requested, key) + do! expectEvent (Started, key) + cts.Cancel() - assertTaskCanceled task1 + do! assertTaskCanceled task1 - expect events - [ Requested, key - Started, key - Canceled, key ] + do! expectEvent (Canceled, key) + } + |> Async2.StartAsTask -[] +[] let ``Job is restarted if first requestor cancels`` () = let jobCanComplete = new ManualResetEvent(false) @@ -169,38 +162,39 @@ let ``Job is restarted if first requestor cancels`` () = } let memoize = AsyncMemoize<_, int, _>() - let events = observe memoize + let expectEvent = observe memoize - use cts1 = new CancellationTokenSource() + let cts1 = new CancellationTokenSource() let key = 1 let task1 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key), cancellationToken = cts1.Token) - waitUntil events (received Started) - cts1.Cancel() + async2 { + do! expectEvent (Requested, key) + do! expectEvent (Started, key) + cts1.Cancel() + + do! assertTaskCanceled task1 - assertTaskCanceled task1 + do! expectEvent (Canceled, key) - waitUntil events (received Canceled) + let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key)) - let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key)) + do! expectEvent (Requested, key) + do! expectEvent (Started, key) - waitUntil events (countOf Started >> (=) 2) + jobCanComplete.Set() |> ignore - jobCanComplete.Set() |> ignore + let! result = task2 - Assert.Equal(2, task2.Result) + Assert.Equal(2, result) - expect events - [ Requested, key - Started, key - Canceled, key - Requested, key - Started, key - Finished, key ] + do! expectEvent (Finished, key) + } + |> Async2.StartAsTask -[] +[] let ``Job is actually cancelled and restarted`` () = let jobCanComplete = new ManualResetEvent(false) let mutable finishedCount = 0 @@ -212,30 +206,35 @@ let ``Job is actually cancelled and restarted`` () = } let memoize = AsyncMemoize<_, int, _>() - let events = observe memoize + let expectEvent = observe memoize let key = wrapKey 1 - for i in 1 .. 10 do - use cts = new CancellationTokenSource() - let task = Async2.StartAsTask( memoize.Get(key, computation), cancellationToken = cts.Token) - waitUntil events (received Started) - cts.Cancel() - assertTaskCanceled task - waitUntil events (received Canceled) - Assert.Equal(1, memoize.Count) + async2 { + for _ in 1 .. 10 do + let cts = new CancellationTokenSource() + let task = Async2.StartAsTask( memoize.Get(key, computation), cancellationToken = cts.Token) + do! expectEvent (Requested, 1) + do! expectEvent (Started, 1) + cts.Cancel() + do! assertTaskCanceled task + do! expectEvent (Canceled, 1) + Assert.Equal(1, memoize.Count) - let _task2 = Async2.StartAsTask( memoize.Get(key, computation)) + Async2.Start( memoize.Get(key, computation)) - waitUntil events (received Started) + do! expectEvent (Requested, 1) + do! expectEvent (Started, 1) - jobCanComplete.Set() |> ignore + jobCanComplete.Set() |> ignore - waitUntil events (received Finished) + do! expectEvent (Finished, 1) - Assert.Equal(1, finishedCount) + Assert.Equal(1, finishedCount) + } + |> Async2.StartAsTask -[] +[] let ``Job keeps running if only one requestor cancels`` () = let jobCanComplete = new ManualResetEvent(false) @@ -246,38 +245,39 @@ let ``Job keeps running if only one requestor cancels`` () = } let memoize = AsyncMemoize<_, int, _>() - let events = observe memoize + let expectEvent = observe memoize - use cts = new CancellationTokenSource() + let cts = new CancellationTokenSource() let key = 1 let task1 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key)) - waitUntil events (received Started) + async2 { + do! expectEvent (Requested, key) + do! expectEvent (Started, key) - let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key) |> Async2.Ignore, cancellationToken = cts.Token) + let task2 = Async2.StartAsTask( memoize.Get(wrapKey key, computation key) |> Async2.Ignore, cancellationToken = cts.Token) - waitUntil events (countOf Requested >> (=) 2) + do! expectEvent (Requested, key) + cts.Cancel() - cts.Cancel() + do! assertTaskCanceled task2 - assertTaskCanceled task2 + jobCanComplete.Set() |> ignore - jobCanComplete.Set() |> ignore + let! result1 = task1 - Assert.Equal(2, task1.Result) + Assert.Equal(2, result1) - expect events - [ Requested, key - Started, key - Requested, key - Finished, key ] + do! expectEvent (Finished, key) + } + |> Async2.StartAsTask type ExpectedException() = inherit Exception() -[] +[] let ``Stress test`` () = let seed = System.Random().Next() @@ -294,8 +294,6 @@ let ``Stress test`` () = let keyCount = rng.Next(5, 200) let keys = [| 1 .. keyCount |] - let testTimeoutMs = threads * iterations * maxDuration * 2 - let intenseComputation durationMs result = async2 { if rng.NextDouble() < exceptionProbability then @@ -386,75 +384,22 @@ let ``Stress test`` () = } loop 1 } - |> Task.WhenAll - if not (test.Wait testTimeoutMs) then failwith "Test timed out - most likely deadlocked" + task { + let! _ = test |> Task.WhenAll - Assert.Equal (threads * iterations, started) - // Assert.Equal((0,0,0,0,0),(started, completed, canceled, failed, timeout)) - Assert.Equal (started, completed + canceled + failed + timeout) + Assert.Equal (threads * iterations, started) + // Assert.Equal((0,0,0,0,0),(started, completed, canceled, failed, timeout)) + Assert.Equal (started, completed + canceled + failed + timeout) - Assert.True ((float completed) > ((float started) * 0.1), "Less than 10 % completed jobs") - - -[] -let ``Cancel running jobs with the same key`` () = - let cache = AsyncMemoize(cancelUnawaitedJobs = false, cancelDuplicateRunningJobs = true) - - let events = observe cache - - let jobCanContinue = new ManualResetEvent(false) - - let work = async2 { - do! awaitHandle jobCanContinue + Assert.True ((float completed) > ((float started) * 0.1), "Less than 10 % completed jobs") } - let key version = - { new ICacheKey<_, _> with - member _.GetKey() = 1 - member _.GetVersion() = version - member _.GetLabel() = $"key1 {version}" } - - let cts = new CancellationTokenSource() - - let jobsToCancel = - [ for i in 1 .. 10 -> Async2.StartAsTask(cache.Get(key i , work), cancellationToken = cts.Token) ] - - waitUntil events (countOf Started >> (=) 10) - - // detach requests from their running computations - cts.Cancel() - - // Cancel the Get requests, leaving the jobs running unawaited. - for job in jobsToCancel do assertTaskCanceled job - - // Start another request. - let job = cache.Get(key 11, work) |> Async2.StartAsTask - - // up til now the jobs should have been running unobserved - let current = eventsWhen events (received Requested) - Assert.Equal(0, current |> countOf Canceled) - - waitUntil events (countOf Started >> (=) 11) - - // Allow the single current request to finish. - jobCanContinue.Set() |> ignore - - job.Wait() - - let events = eventsWhen events (received Finished) - - Assert.Equal(0, events |> countOf Failed) - - // All outdated jobs should have been canceled by now. - Assert.Equal(10, events |> countOf Canceled) - - Assert.Equal(1, events |> countOf Finished) type DummyException(msg) = inherit Exception(msg) -[] +[] let ``Preserve thread static diagnostics`` () = let seed = System.Random().Next() @@ -472,7 +417,7 @@ let ``Preserve thread static diagnostics`` () = } let job2 (input: int) = async2 { - + DiagnosticsThreadStatics.DiagnosticsLogger.Warning(DummyException("job2 error 1")) let! _ = Async.Sleep (rng.Next(1, 30)) @@ -517,18 +462,20 @@ let ``Preserve thread static diagnostics`` () = } } - let results = (Task.WhenAll tasks).Result + task { + let! results = (Task.WhenAll tasks) - let diagnosticCounts = results |> Seq.map snd |> Seq.map Array.length |> Seq.groupBy id |> Seq.map (fun (k, v) -> k, v |> Seq.length) |> Seq.sortBy fst |> Seq.toList + let diagnosticCounts = results |> Seq.map snd |> Seq.map Array.length |> Seq.groupBy id |> Seq.map (fun (k, v) -> k, v |> Seq.length) |> Seq.sortBy fst |> Seq.toList - Assert.Equal<(int * int) list>([4, 100], diagnosticCounts) + Assert.Equal<(int * int) list>([4, 100], diagnosticCounts) - let diagnosticMessages = results |> Seq.map snd |> Seq.map (Array.map _.Exception.Message >> Array.toList) |> Set + let diagnosticMessages = results |> Seq.map snd |> Seq.map (Array.map _.Exception.Message >> Array.toList) |> Set - Assert.Equal>(Set [["task error"; "job2 error 1"; "job1 error"; "job2 error 2"; ]], diagnosticMessages) + Assert.Equal>(Set [["task error"; "job2 error 1"; "job1 error"; "job2 error 2"; ]], diagnosticMessages) + } -[] +[] let ``Preserve thread static diagnostics already completed job`` () = let cache = AsyncMemoize() @@ -544,23 +491,22 @@ let ``Preserve thread static diagnostics already completed job`` () = return Ok input } - task { - + async2 { let diagnosticsLogger = CompilationDiagnosticLogger($"Testing", FSharpDiagnosticOptions.Default) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.Optimize) - let! _ = cache.Get(key, job "1" ) |> Async2.StartAsTask - let! _ = cache.Get(key, job "2" ) |> Async2.StartAsTask + let! _ = cache.Get(key, job "1" ) + let! _ = cache.Get(key, job "2" ) let diagnosticMessages = diagnosticsLogger.GetDiagnostics() |> Array.map _.Exception.Message |> Array.toList Assert.Equal<_ list>(["job 1 error"; "job 1 error"], diagnosticMessages) - } + |> Async2.StartAsTask -[] +[] let ``We get diagnostics from the job that failed`` () = let cache = AsyncMemoize() @@ -578,14 +524,15 @@ let ``We get diagnostics from the job that failed`` () = return 5 } - task { + async2 { let logger = CapturingDiagnosticsLogger("AsyncMemoize diagnostics test") SetThreadDiagnosticsLoggerNoUnwind logger - do! cache.Get(key, job ) |> Async2.Catch |> Async2.Ignore |> Async2.StartAsTask + do! cache.Get(key, job ) |> Async2.Catch |> Async2.Ignore let messages = logger.Diagnostics |> List.map _.Exception.Message Assert.Equal<_ list>(["job error"], messages) } + |> Async2.StartAsTask diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index 639a07b20bc..11789c1db0b 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -12595,6 +12595,13 @@ Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.R Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[c],d] Async2Builder.ReturnFrom[a,b,c,d](Async2Builder, a) Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind$W[a,b,c,d,e](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind[a,b,c,d,e](Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Internal.Utilities.Library.Async2`1[Msg] Receive() +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Internal.Utilities.Library.MailboxProcessor2`1[Msg] Start(Microsoft.FSharp.Core.FSharpFunc`2[Internal.Utilities.Library.MailboxProcessor2`1[Msg],Internal.Utilities.Library.Async2`1[Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Microsoft.FSharp.Control.FSharpHandler`1[System.Exception] Error +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void Dispose() +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void Post(Msg) +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void add_Error(Microsoft.FSharp.Control.FSharpHandler`1[System.Exception]) +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void remove_Error(Microsoft.FSharp.Control.FSharpHandler`1[System.Exception]) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFromFinal[a](Async2Builder, System.Threading.Tasks.Task) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFrom[a](Async2Builder, System.Threading.Tasks.Task) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.Bind[a,b](Async2Builder, System.Threading.Tasks.Task, Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b]]) From b317ecf245297d2917f9168af66242f9502d8af2 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 26 Feb 2026 19:57:29 +0100 Subject: [PATCH 24/43] update vs, too --- build_errors.txt | 214 ++++++++++++++++++ build_errors2.txt | 190 ++++++++++++++++ src/Compiler/Utilities/Async2.fs | 46 ++-- ...iler.Service.SurfaceArea.netstandard20.bsl | 5 +- .../Classification/ClassificationService.fs | 16 +- .../CodeFixes/AddInstanceMemberParameter.fs | 6 +- .../AddMissingEqualsToTypeDefinition.fs | 6 +- .../CodeFixes/AddMissingFunKeyword.fs | 8 +- .../AddMissingRecToMutuallyRecFunctions.fs | 8 +- .../FSharp.Editor/CodeFixes/AddMissingSeq.fs | 6 +- ...eywordToDisposableConstructorInvocation.fs | 4 +- .../CodeFixes/AddOpenCodeFixProvider.fs | 4 +- ...peAnnotationToObjectOfIndeterminateType.fs | 6 +- .../ChangeEqualsInFieldTypeToColon.fs | 8 +- .../ChangePrefixNegationToInfixSubtraction.fs | 6 +- .../ChangeRefCellDerefToNotExpression.fs | 6 +- .../FSharp.Editor/CodeFixes/ChangeToUpcast.fs | 6 +- .../FSharp.Editor/CodeFixes/CodeFixHelpers.fs | 44 ++-- .../ConvertCSharpLambdaToFSharpLambda.fs | 8 +- .../ConvertCSharpUsingToFSharpOpen.fs | 6 +- .../CodeFixes/ConvertToAnonymousRecord.fs | 6 +- .../ConvertToNotEqualsEqualityExpression.fs | 6 +- ...ConvertToSingleEqualsEqualityExpression.fs | 6 +- .../CodeFixes/DiscardUnusedValue.fs | 6 +- .../CodeFixes/FixIndexerAccess.fs | 4 +- .../CodeFixes/FixIndexerAccessLegacy.fs | 6 +- .../FSharp.Editor/CodeFixes/IFSharpCodeFix.fs | 8 +- .../CodeFixes/ImplementInterface.fs | 14 +- .../CodeFixes/MakeDeclarationMutable.fs | 6 +- .../CodeFixes/MakeOuterBindingRecursive.fs | 6 +- .../CodeFixes/MissingReference.fs | 10 +- .../CodeFixes/PrefixUnusedValue.fs | 6 +- .../CodeFixes/ProposeUppercaseLabel.fs | 4 +- .../CodeFixes/RemoveReturnOrYield.fs | 6 +- ...uperfluousCaptureForUnionCaseWithNoData.fs | 6 +- .../CodeFixes/RemoveUnnecessaryParentheses.fs | 6 +- .../CodeFixes/RemoveUnusedBinding.fs | 8 +- .../CodeFixes/RemoveUnusedOpens.fs | 4 +- .../CodeFixes/RenameParamToMatchSignature.fs | 4 +- .../CodeFixes/ReplaceWithSuggestion.fs | 4 +- .../FSharp.Editor/CodeFixes/SimplifyName.fs | 4 +- .../UseMutationWhenValueIsMutable.fs | 6 +- .../CodeFixes/UseTripleQuotedInterpolation.fs | 4 +- .../CodeFixes/WrapExpressionInParentheses.fs | 6 +- .../Commands/HelpContextService.fs | 16 +- .../Commands/XmlDocCommandService.fs | 16 +- .../src/FSharp.Editor/Common/DebugHelpers.fs | 6 +- .../src/FSharp.Editor/Common/DocumentCache.fs | 11 +- .../src/FSharp.Editor/Common/Pervasive.fs | 63 +++--- .../src/FSharp.Editor/Common/RoslynHelpers.fs | 68 ------ .../Completion/CompletionProvider.fs | 18 +- .../HashDirectiveCompletionProvider.fs | 9 +- .../FSharp.Editor/Completion/SignatureHelp.fs | 16 +- .../Debugging/BreakpointResolutionService.fs | 12 +- .../Debugging/LanguageDebugInfoService.fs | 10 +- .../Diagnostics/DocumentDiagnosticAnalyzer.fs | 14 +- .../SimplifyNameDiagnosticAnalyzer.fs | 24 +- ...nnecessaryParenthesesDiagnosticAnalyzer.fs | 10 +- .../Diagnostics/UnusedDeclarationsAnalyzer.fs | 6 +- .../UnusedOpensDiagnosticAnalyzer.fs | 10 +- .../DocumentHighlightsService.fs | 12 +- .../Formatting/BraceMatchingService.fs | 13 +- .../Formatting/EditorFormattingService.fs | 23 +- .../Hints/FSharpInlineHintsService.fs | 14 +- .../src/FSharp.Editor/Hints/HintService.fs | 8 +- .../src/FSharp.Editor/Hints/Hints.fs | 6 +- .../Hints/InlineParameterNameHints.fs | 6 +- .../Hints/InlineReturnTypeHints.fs | 4 +- .../FSharp.Editor/Hints/InlineTypeHints.fs | 6 +- .../Hints/NativeToRoslynHintConverter.fs | 10 +- .../InlineRename/InlineRenameService.fs | 43 ++-- .../FSharpAnalysisSaveFileCommandHandler.fs | 8 +- .../FSharpProjectOptionsManager.fs | 20 +- .../LanguageService/LanguageService.fs | 16 +- .../LanguageService/SymbolHelpers.fs | 39 ++-- .../LanguageService/WorkspaceExtensions.fs | 130 +++++------ .../Navigation/FindDefinitionService.fs | 8 +- .../Navigation/FindUsagesService.fs | 28 +-- .../Navigation/GoToDefinition.fs | 73 +++--- .../Navigation/GoToDefinitionService.fs | 8 +- .../Navigation/NavigableSymbolsService.fs | 11 +- .../Navigation/NavigateToSearchService.fs | 20 +- .../Navigation/NavigationBarItemService.fs | 8 +- .../QuickInfo/QuickInfoProvider.fs | 14 +- .../Refactor/AddExplicitTypeToParameter.fs | 22 +- .../FSharp.Editor/Refactor/AddReturnType.fs | 32 +-- .../Refactor/ChangeDerefToValueRefactoring.fs | 16 +- .../ChangeTypeofWithNameToNameofExpression.fs | 16 +- .../Structure/BlockStructureService.fs | 12 +- .../FSharp.Editor/TaskList/TaskListService.fs | 15 +- .../BraceMatchingServiceTests.fs | 7 +- .../BreakpointResolutionServiceTests.fs | 7 +- .../CodeFixes/CodeFixTestFramework.fs | 36 ++- .../RemoveUnnecessaryParenthesesTests.fs | 9 +- .../CompletionProviderTests.fs | 24 +- .../DocumentDiagnosticAnalyzerTests.fs | 22 +- .../DocumentHighlightsServiceTests.fs | 9 +- .../EditorFormattingServiceTests.fs | 9 +- .../FsxCompletionProviderTests.fs | 9 +- .../GoToDefinitionServiceTests.fs | 4 +- .../HelpContextServiceTests.fs | 9 +- .../Hints/HintTestFramework.fs | 27 +-- .../QuickInfoProviderTests.fs | 9 +- .../FSharp.Editor.Tests/QuickInfoTests.fs | 6 +- .../SemanticClassificationServiceTests.fs | 8 +- .../SignatureHelpProviderTests.fs | 17 +- .../UnitTests/Workspace/WorkspaceTests.fs | 6 +- 107 files changed, 1109 insertions(+), 808 deletions(-) create mode 100644 build_errors.txt create mode 100644 build_errors2.txt diff --git a/build_errors.txt b/build_errors.txt new file mode 100644 index 00000000000..9852db63133 --- /dev/null +++ b/build_errors.txt @@ -0,0 +1,214 @@ + Determining projects to restore... + All projects are up-to-date for restore. + FSharp.Core -> E:\repos\fsharp\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll + FSharp.DependencyManager.Nuget -> E:\repos\fsharp\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll + FSharp.Compiler.Service -> E:\repos\fsharp\artifacts\bin\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll + FSharp.UIResources -> E:\repos\fsharp\artifacts\bin\FSharp.UIResources\Debug\net472\FSharp.UIResources.dll + FSharp.VS.FSI -> E:\repos\fsharp\artifacts\bin\FSharp.VS.FSI\Debug\net472\FSharp.VS.FSI.dll +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Common\DebugHelpers.fs(124,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(200,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(325,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpAnalysisSaveFileCommandHandler.fs(54,29): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(198,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(358,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(316,17): error FS1182: The value 'solutionEventsOpt' is unused [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(58,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(68,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(67,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b -> Async<'c option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async<'b option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(83,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(111,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(175,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(187,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(255,55): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(258,33): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(259,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(257,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (SemanticClassificationData -> 'b)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(291,52): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(296,54): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(298,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(300,37): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(302,33): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(293,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> CancellableTaskCode<'d,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(25,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(53,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(55,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(54,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(58,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedDeclarationsAnalyzer.fs(28,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(23,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(44,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(156,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(320,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(411,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(41,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(59,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(95,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(151,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(188,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(60,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(115,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(180,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(244,44): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(250,39): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0041: A unique overload for method 'Source' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(256,21): error FS0041: A unique overload for method 'BindReturn' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (TextSpan -> FSharpNavigableItem option)Candidates: - member CancellableTaskBuilderBase.BindReturn: [] getAwaiter: (CancellationToken -> ^Awaiter) * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.BindReturn: getAwaiter: ^Awaiter * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(246,21): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> 'd)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(280,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(365,34): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(369,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(376,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(617,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(629,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(687,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(738,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(782,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(858,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(1064,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigableSymbolsService.fs(43,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinitionService.fs(22,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigationBarItemService.fs(24,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(37,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(147,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(194,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(217,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(31,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(66,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(90,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindDefinitionService.fs(20,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(27,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(77,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(121,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(164,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(24,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] + +Build FAILED. + +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Common\DebugHelpers.fs(124,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(200,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(325,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpAnalysisSaveFileCommandHandler.fs(54,29): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(198,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(358,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(316,17): error FS1182: The value 'solutionEventsOpt' is unused [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(58,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(68,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(67,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b -> Async<'c option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async<'b option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(83,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(111,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(175,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(187,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(255,55): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(258,33): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(259,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(257,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (SemanticClassificationData -> 'b)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(291,52): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(296,54): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(298,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(300,37): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(302,33): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(293,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> CancellableTaskCode<'d,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(25,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(53,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(55,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(54,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(58,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedDeclarationsAnalyzer.fs(28,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(23,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(44,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(156,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(320,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(411,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(41,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(59,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(95,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(151,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(188,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(60,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(115,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(180,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(244,44): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(250,39): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0041: A unique overload for method 'Source' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(256,21): error FS0041: A unique overload for method 'BindReturn' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (TextSpan -> FSharpNavigableItem option)Candidates: - member CancellableTaskBuilderBase.BindReturn: [] getAwaiter: (CancellationToken -> ^Awaiter) * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.BindReturn: getAwaiter: ^Awaiter * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(246,21): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> 'd)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(280,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(365,34): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(369,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(376,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(617,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(629,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(687,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(738,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(782,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(858,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(1064,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigableSymbolsService.fs(43,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinitionService.fs(22,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigationBarItemService.fs(24,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(37,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(147,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(194,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(217,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(31,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(66,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(90,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindDefinitionService.fs(20,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(27,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(77,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(121,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(164,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(24,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] + 0 Warning(s) + 100 Error(s) + +Time Elapsed 00:00:08.54 diff --git a/build_errors2.txt b/build_errors2.txt new file mode 100644 index 00000000000..e32890ea784 --- /dev/null +++ b/build_errors2.txt @@ -0,0 +1,190 @@ + Determining projects to restore... + All projects are up-to-date for restore. + FSharp.Core -> E:\repos\fsharp\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll + FSharp.DependencyManager.Nuget -> E:\repos\fsharp\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll + FSharp.Compiler.Service -> E:\repos\fsharp\artifacts\bin\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll + FSharp.VS.FSI -> E:\repos\fsharp\artifacts\bin\FSharp.VS.FSI\Debug\net472\FSharp.VS.FSI.dll + FSharp.UIResources -> E:\repos\fsharp\artifacts\bin\FSharp.UIResources\Debug\net472\FSharp.UIResources.dll +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(216,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(225,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(437,29): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(347,42): error FS0008: This runtime coercion or type test from type 'a  to  OleMenuCommandService involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(371,36): error FS0008: This runtime coercion or type test from type 'a  to  IVsSolution involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(376,31): error FS0008: This runtime coercion or type test from type 'a  to  IVsRunningDocumentTable involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(171,21): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(163,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(216,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(304,20): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(30,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(33,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(38,38): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(39,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(60,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(72,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(133,40): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,65): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(142,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(33,82): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(162,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(163,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(164,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(165,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(166,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(50,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(52,55): error FS0041: A unique overload for method 'WithDocumentText' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: DocumentId * 'aCandidates: - Solution.WithDocumentText(documentId: DocumentId, text: SourceText, ?mode: PreservationMode) : Solution - Solution.WithDocumentText(documentId: DocumentId, textAndVersion: TextAndVersion, ?mode: PreservationMode) : Solution [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(101,9): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(191,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(192,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(193,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(208,25): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(76,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(77,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(78,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(380,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(381,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(383,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(384,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(804,27): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(94,30): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,13): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(88,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(89,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(90,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(176,16): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: cancellationToken [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(29,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(30,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(31,24): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(34,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(37,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,97): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,119): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(58,37): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(84,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(117,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(124,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(68,26): error FS0041: No overloads match for method 'Create'.Known types of arguments: System.String * Async2 * System.StringAvailable overloads: - CodeAction.Create(title: string, createChangedDocument: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool) : CodeAction // Argument 'nestedActions' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool, ?priority: CodeActionPriority) : CodeAction // Argument 'nestedActions' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(83,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(84,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(85,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(82,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(172,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\ImplementInterface.fs(260,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(54,92): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(57,66): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(38,49): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(42,40): error FS0039: The type 'Unit' does not define the field, constructor or member 'ToImmutableArray'. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] + +Build FAILED. + +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(216,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(225,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(437,29): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(347,42): error FS0008: This runtime coercion or type test from type 'a  to  OleMenuCommandService involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(371,36): error FS0008: This runtime coercion or type test from type 'a  to  IVsSolution involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(376,31): error FS0008: This runtime coercion or type test from type 'a  to  IVsRunningDocumentTable involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(171,21): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(163,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(216,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(304,20): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(30,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(33,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(38,38): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(39,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(60,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(72,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(133,40): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,65): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(142,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(33,82): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(162,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(163,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(164,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(165,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(166,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(50,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(52,55): error FS0041: A unique overload for method 'WithDocumentText' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: DocumentId * 'aCandidates: - Solution.WithDocumentText(documentId: DocumentId, text: SourceText, ?mode: PreservationMode) : Solution - Solution.WithDocumentText(documentId: DocumentId, textAndVersion: TextAndVersion, ?mode: PreservationMode) : Solution [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(101,9): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(191,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(192,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(193,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(208,25): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(76,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(77,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(78,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(380,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(381,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(383,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(384,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(804,27): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(94,30): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,13): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(88,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(89,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(90,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(176,16): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: cancellationToken [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(29,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(30,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(31,24): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(34,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(37,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,97): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,119): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(58,37): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(84,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(117,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(124,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(68,26): error FS0041: No overloads match for method 'Create'.Known types of arguments: System.String * Async2 * System.StringAvailable overloads: - CodeAction.Create(title: string, createChangedDocument: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool) : CodeAction // Argument 'nestedActions' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool, ?priority: CodeActionPriority) : CodeAction // Argument 'nestedActions' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(83,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(84,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(85,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(82,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(172,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\ImplementInterface.fs(260,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(54,92): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(57,66): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(38,49): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] +E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(42,40): error FS0039: The type 'Unit' does not define the field, constructor or member 'ToImmutableArray'. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] + 0 Warning(s) + 88 Error(s) + +Time Elapsed 00:00:08.35 diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 59ebf1c8add..91483dc36da 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -415,11 +415,12 @@ module MediumPriority = member inline this.Bind(expr: Async<_>, [] continuation) = bindCancellableAwaiter ((fun ct -> Async.StartAsTask(expr, cancellationToken = ct).GetAwaiter()), continuation) - member inline this.Bind(task: Task, [] continuation) = - bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) + //member inline this.Bind(task: Task, [] continuation) = + // bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) member inline this.Bind(task: Task<_>, [] continuation) = - bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) + //bindAwaiter (task.ConfigureAwait(false).GetAwaiter(), continuation) + bindAwaiter (task.GetAwaiter(), continuation) member inline this.ReturnFrom(task: Task) = this.Bind(task, this.Return) member inline this.ReturnFrom(task: Task<_>) = this.Bind(task, this.Return) @@ -476,6 +477,10 @@ module Async2 = finally CheckAndThrowToken.Value <- oldCt + let startAsTask ct (code: Async2<_>) = startImmediate ct code + + let startAsUnitTask ct (code: Async2) = startImmediate ct code :> Task + let run ct (code: Async2<'t>) = startInThreadPool ct code |> _.GetAwaiter().GetResult() @@ -500,6 +505,28 @@ module Async2 = true) ) + let whenAll (computations: Async2<_> seq): Async2<'TResult array> = + async2 { + let! ct = CancellationToken + use lcts = CancellationTokenSource.CreateLinkedTokenSource ct + + try + let tasks = computations |> Seq.map (startInThreadPool lcts.Token) + return! Task.WhenAll<'TResult>(tasks) + with exn -> + lcts.Cancel() + return raise exn + } + + let inline map + ([] mapper: 'input -> 'output) + (computation: Async2<'input>) + = + async2 { + let! result = computation + return mapper result + } + type Async2 = static member Ignore(computation: Async2<_>) : Async2 = async2 { @@ -523,18 +550,7 @@ type Async2 = let ct = defaultArg cancellationToken CancellationToken.None Async2.run ct computation - static member Parallel(computations: Async2<_> seq) = - async2 { - let! ct = Async2.CancellationToken - use lcts = CancellationTokenSource.CreateLinkedTokenSource ct - - try - let tasks = computations |> Seq.map (Async2.startInThreadPool lcts.Token) - return! Task.WhenAll tasks - with exn -> - lcts.Cancel() - return raise exn - } + static member Parallel(computations: Async2<_> seq) = Async2.whenAll computations static member Sequential(computations: Async2<_> seq) = async2 { diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index 11789c1db0b..a09c2b9bf04 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -12559,11 +12559,15 @@ Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Asyn Internal.Utilities.Library.Async2Implementation: Internal.Utilities.Library.Async2Implementation+Trampoline Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[System.Threading.CancellationToken] CancellationToken Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[System.Threading.CancellationToken] get_CancellationToken() +Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[TResult[]] whenAll[TResult](System.Collections.Generic.IEnumerable`1[Internal.Utilities.Library.Async2`1[TResult]]) +Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[output] map[input,output](Microsoft.FSharp.Core.FSharpFunc`2[input,output], Internal.Utilities.Library.Async2`1[input]) Internal.Utilities.Library.Async2Module: Internal.Utilities.Library.Async2`1[t] fromValue[t](t) Internal.Utilities.Library.Async2Module: Microsoft.FSharp.Control.FSharpAsync`1[t] toAsync[t](Internal.Utilities.Library.Async2`1[t]) Internal.Utilities.Library.Async2Module: System.Threading.AsyncLocal`1[System.Threading.CancellationToken] CheckAndThrowToken Internal.Utilities.Library.Async2Module: System.Threading.AsyncLocal`1[System.Threading.CancellationToken] get_CheckAndThrowToken() +Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task startAsUnitTask(System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[Microsoft.FSharp.Core.Unit]) Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[a] startAsTaskWithoutCancellation[a](Internal.Utilities.Library.Async2`1[a]) +Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[a] startAsTask[a](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[a]) Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[a] startImmediate[a](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[a]) Internal.Utilities.Library.Async2Module: System.Threading.Tasks.Task`1[t] startInThreadPool[t](System.Threading.CancellationToken, Internal.Utilities.Library.Async2`1[t]) Internal.Utilities.Library.Async2Module: a runWithoutCancellation[a](Internal.Utilities.Library.Async2`1[a]) @@ -12604,7 +12608,6 @@ Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void add_Error(Microsoft.FS Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void remove_Error(Microsoft.FSharp.Control.FSharpHandler`1[System.Exception]) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFromFinal[a](Async2Builder, System.Threading.Tasks.Task) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[Microsoft.FSharp.Core.Unit],a] Async2Builder.ReturnFrom[a](Async2Builder, System.Threading.Tasks.Task) -Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.Bind[a,b](Async2Builder, System.Threading.Tasks.Task, Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b]]) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFromFinal[a,b](Async2Builder, Microsoft.FSharp.Control.FSharpAsync`1[a]) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFromFinal[a,b](Async2Builder, System.Threading.Tasks.Task`1[a]) Internal.Utilities.Library.MediumPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[a],b] Async2Builder.ReturnFrom[a,b](Async2Builder, Microsoft.FSharp.Control.FSharpAsync`1[a]) diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs index fb2715debd3..108a103c8de 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -16,7 +16,7 @@ open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification open FSharp.Compiler.EditorServices open FSharp.Compiler.Tokenization -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Telemetry // IEditorClassificationService is marked as Obsolete, but is still supported. The replacement (IClassificationService) @@ -160,10 +160,10 @@ type internal FSharpClassificationService [] () = System.Threading.Tasks.Task.CompletedTask else - cancellableTask { + async2 { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Syntactic) - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let defines, langVersion, strictIndentation = document.GetFsharpParsingOptions() @@ -203,7 +203,7 @@ type internal FSharpClassificationService [] () = cancellationToken ) } - |> CancellableTask.startAsTask cancellationToken + |> Async2.startAsUnitTask cancellationToken member _.AddSemanticClassificationsAsync (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) @@ -213,7 +213,7 @@ type internal FSharpClassificationService [] () = System.Threading.Tasks.Task.CompletedTask else - cancellableTask { + async2 { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Semantic) let! sourceText = document.GetTextAsync(cancellationToken) @@ -301,8 +301,8 @@ type internal FSharpClassificationService [] () = addSemanticClassification sourceText textSpan classificationData result } - |> CancellableTask.ifCanceledReturn () - |> CancellableTask.startAsTask cancellationToken + //|> CancellableTask.ifCanceledReturn () + |> Async2.startAsUnitTask cancellationToken // Do not perform classification if we don't have project options (#defines matter) member _.AdjustStaleClassification(_: SourceText, classifiedSpan: ClassifiedSpan) : ClassifiedSpan = classifiedSpan diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddInstanceMemberParameter.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddInstanceMemberParameter.fs index dcdc29fc906..32e6f29104b 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddInstanceMemberParameter.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddInstanceMemberParameter.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -8,7 +8,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal AddInstanceMemberParameterCodeFixProvider() = @@ -29,4 +29,4 @@ type internal AddInstanceMemberParameterCodeFixProvider() = Changes = [ TextChange(TextSpan(context.Span.Start, 0), "x.") ] } - CancellableTask.singleton (ValueSome codeFix) + Async2.fromValue (ValueSome codeFix) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingEqualsToTypeDefinition.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingEqualsToTypeDefinition.fs index a5cd9ec4e99..6cdb820f40b 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingEqualsToTypeDefinition.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingEqualsToTypeDefinition.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open System.Threading.Tasks open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal AddMissingEqualsToTypeDefinitionCodeFixProvider() = @@ -33,7 +33,7 @@ type internal AddMissingEqualsToTypeDefinitionCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! range = context.GetErrorRangeAsync() let! parseResults = context.Document.GetFSharpParseResultsAsync(nameof AddMissingEqualsToTypeDefinitionCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingFunKeyword.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingFunKeyword.fs index adc0cc8db01..fb58b97ae55 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingFunKeyword.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingFunKeyword.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -10,7 +10,7 @@ open System.Threading.Tasks open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal AddMissingFunKeywordCodeFixProvider [] () = @@ -43,13 +43,13 @@ type internal AddMissingFunKeywordCodeFixProvider [] () = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! textOfError = context.GetSquigglyTextAsync() if textOfError <> "->" then return ValueNone else - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let document = context.Document let! defines, langVersion, strictIndentation = diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingRecToMutuallyRecFunctions.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingRecToMutuallyRecFunctions.fs index 0a601af0e55..64387569dee 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingRecToMutuallyRecFunctions.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingRecToMutuallyRecFunctions.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open System.Composition open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal AddMissingRecToMutuallyRecFunctionsCodeFixProvider [] () = @@ -23,8 +23,8 @@ type internal AddMissingRecToMutuallyRecFunctionsCodeFixProvider [] [] @@ -24,7 +24,7 @@ type internal AddMissingSeqCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let! parseFileResults = context.Document.GetFSharpParseResultsAsync(nameof AddMissingSeqCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddNewKeywordToDisposableConstructorInvocation.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddNewKeywordToDisposableConstructorInvocation.fs index af0309b1810..c600e57c5f0 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddNewKeywordToDisposableConstructorInvocation.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddNewKeywordToDisposableConstructorInvocation.fs @@ -11,7 +11,7 @@ open FSharp.Compiler.Text open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal AddNewKeywordCodeFixProvider() = @@ -27,7 +27,7 @@ type internal AddNewKeywordCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let! parseFileResults = context.Document.GetFSharpParseResultsAsync(nameof AddNewKeywordCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs index 77727c18684..c98f576dce7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddOpenCodeFixProvider.fs @@ -13,7 +13,7 @@ open FSharp.Compiler.EditorServices open FSharp.Compiler.Syntax open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library [] type internal AddOpenCodeFixProvider [] (assemblyContentProvider: AssemblyContentProvider) = @@ -108,7 +108,7 @@ type internal AddOpenCodeFixProvider [] (assemblyContentPr interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let document = context.Document let! sourceText = context.GetSourceTextAsync() diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddTypeAnnotationToObjectOfIndeterminateType.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddTypeAnnotationToObjectOfIndeterminateType.fs index 4accffe94bd..aca8f4125de 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddTypeAnnotationToObjectOfIndeterminateType.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddTypeAnnotationToObjectOfIndeterminateType.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -12,7 +12,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.EditorServices open FSharp.Compiler.Symbols -open CancellableTasks +open Internal.Utilities.Library [] type internal AddTypeAnnotationToObjectOfIndeterminateTypeFixProvider [] () = @@ -26,7 +26,7 @@ type internal AddTypeAnnotationToObjectOfIndeterminateTypeFixProvider [] type internal ChangeEqualsInFieldTypeToColonCodeFixProvider() = @@ -20,7 +20,7 @@ type internal ChangeEqualsInFieldTypeToColonCodeFixProvider() = static let errorMessage = SR.UnexpectedEqualsInFieldExpectedColon() let isInRecord (document: Document) (range: range) = - cancellableTask { + async2 { let! parseResults = document.GetFSharpParseResultsAsync(nameof ChangeEqualsInFieldTypeToColonCodeFixProvider) return parseResults.IsPositionWithinRecordDefinition(range.Start) @@ -39,7 +39,7 @@ type internal ChangeEqualsInFieldTypeToColonCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! spanText = context.GetSquigglyTextAsync() if spanText <> "=" then diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ChangePrefixNegationToInfixSubtraction.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ChangePrefixNegationToInfixSubtraction.fs index ee8b8870538..9a8dfe3883b 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ChangePrefixNegationToInfixSubtraction.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ChangePrefixNegationToInfixSubtraction.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal ChangePrefixNegationToInfixSubtractionCodeFixProvider() = @@ -32,7 +32,7 @@ type internal ChangePrefixNegationToInfixSubtractionCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() // in a line like "... x -1 ...", diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ChangeRefCellDerefToNotExpression.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ChangeRefCellDerefToNotExpression.fs index 16a764b3398..f4e6eb04045 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ChangeRefCellDerefToNotExpression.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ChangeRefCellDerefToNotExpression.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -8,7 +8,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal ChangeRefCellDerefToNotExpressionCodeFixProvider [] () = @@ -22,7 +22,7 @@ type internal ChangeRefCellDerefToNotExpressionCodeFixProvider [] type internal ChangeToUpcastCodeFixProvider() = @@ -20,7 +20,7 @@ type internal ChangeToUpcastCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! text = context.GetSquigglyTextAsync() // Only works if it's one or the other diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs index ce646f98f25..968c5ab0e81 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -17,7 +17,7 @@ open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library module internal UnusedCodeFixHelper = let getUnusedSymbol textSpan (document: Document) (sourceText: SourceText) codeFixName = @@ -26,7 +26,7 @@ module internal UnusedCodeFixHelper = // Prefixing operators and backticked identifiers does not make sense. // We have to use the additional check for backticks if PrettyNaming.IsIdentifierName ident then - cancellableTask { + async2 { let! lexerSymbol = document.TryFindFSharpLexerSymbolAsync(textSpan.Start, SymbolLookupKind.Greedy, false, false, CodeFix.RenameUnusedValue) @@ -47,7 +47,7 @@ module internal UnusedCodeFixHelper = | _ -> ValueNone) } else - CancellableTask.singleton ValueNone + Async2.fromValue ValueNone [] module internal CodeFixHelpers = @@ -77,13 +77,13 @@ module internal CodeFixHelpers = CodeAction.Create( codeFix.Message, (fun cancellationToken -> - cancellableTask { - let! sourceText = context.Document.GetTextAsync cancellationToken + async2 { + let! sourceText : Text.SourceText = context.Document.GetTextAsync cancellationToken let doc = context.Document.WithText(sourceText.WithChanges(codeFix.Changes)) reportCodeFixTelemetry context.Diagnostics context.Document codeFix.Name [||] return doc } - |> CancellableTask.start cancellationToken) + |> Async2.startInThreadPool cancellationToken) ) [] @@ -91,45 +91,45 @@ module internal CodeFixExtensions = type CodeFixContext with member ctx.RegisterFsharpFix(codeFix: IFSharpCodeFixProvider) = - cancellableTask { + async2 { match! codeFix.GetCodeFixIfAppliesAsync ctx with | ValueSome codeFix -> let codeAction = CodeFixHelpers.createTextChangeCodeFix (codeFix, ctx) ctx.RegisterCodeFix(codeAction, ctx.Diagnostics) | ValueNone -> () } - |> CancellableTask.startAsTask ctx.CancellationToken + |> Async2.startAsUnitTask ctx.CancellationToken member ctx.RegisterFsharpFixes(codeFix: IFSharpMultiCodeFixProvider) = - cancellableTask { + async2 { let! codeFixes = codeFix.GetCodeFixesAsync ctx for codeFix in codeFixes do let codeAction = CodeFixHelpers.createTextChangeCodeFix (codeFix, ctx) ctx.RegisterCodeFix(codeAction, ctx.Diagnostics) } - |> CancellableTask.startAsTask ctx.CancellationToken + |> Async2.startAsUnitTask ctx.CancellationToken member ctx.GetSourceTextAsync() = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken return! ctx.Document.GetTextAsync cancellationToken } member ctx.GetSquigglyTextAsync() = - cancellableTask { + async2 { let! sourceText = ctx.GetSourceTextAsync() return sourceText.GetSubText(ctx.Span).ToString() } member ctx.GetErrorRangeAsync() = - cancellableTask { + async2 { let! sourceText = ctx.GetSourceTextAsync() return RoslynHelpers.TextSpanToFSharpRange(ctx.Document.FilePath, ctx.Span, sourceText) } member ctx.GetLineNumberAndText position = - cancellableTask { + async2 { let! sourceText = ctx.GetSourceTextAsync() let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position @@ -149,11 +149,11 @@ module IFSharpCodeFixProviderExtensions = type IFSharpCodeFixProvider with member private provider.FixAllAsync (fixAllCtx: FixAllContext) (doc: Document) (allDiagnostics: ImmutableArray) = - cancellableTask { + async2 { let sw = Stopwatch.StartNew() - let! token = CancellableTask.getCancellationToken () - let! sourceText = doc.GetTextAsync token + let! token = Async2.CancellationToken + let! sourceText : SourceText = doc.GetTextAsync token let! codeFixOpts = allDiagnostics @@ -165,7 +165,7 @@ module IFSharpCodeFixProviderExtensions = |> Seq.map (fun diag -> let context = CodeFixContext(doc, diag, registerCodeFix, token) provider.GetCodeFixIfAppliesAsync context) - |> CancellableTask.whenAll + |> Async2.whenAll let codeFixes = codeFixOpts |> Seq.map ValueOption.toOption |> Seq.choose id let changes = codeFixes |> Seq.collect (fun codeFix -> codeFix.Changes) @@ -193,11 +193,11 @@ module IFSharpCodeFixProviderExtensions = member provider.RegisterFsharpFixAll() = FixAllProvider.Create(fun fixAllCtx doc allDiagnostics -> provider.FixAllAsync fixAllCtx doc allDiagnostics - |> CancellableTask.start fixAllCtx.CancellationToken) + |> Async2.startInThreadPool fixAllCtx.CancellationToken) member provider.RegisterFsharpFixAll filter = FixAllProvider.Create(fun fixAllCtx doc allDiagnostics -> let filteredDiagnostics = filter allDiagnostics provider.FixAllAsync fixAllCtx doc filteredDiagnostics - |> CancellableTask.start fixAllCtx.CancellationToken) + |> Async2.startInThreadPool fixAllCtx.CancellationToken) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs index 7834cfa0795..4f1b8e7fcd2 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library [] type internal ConvertCSharpLambdaToFSharpLambdaCodeFixProvider [] () = @@ -33,8 +33,8 @@ type internal ConvertCSharpLambdaToFSharpLambdaCodeFixProvider [] type internal ConvertCSharpUsingToFSharpOpenCodeFixProvider [] () = @@ -52,7 +52,7 @@ type internal ConvertCSharpUsingToFSharpOpenCodeFixProvider [] type internal ConvertToAnonymousRecordCodeFixProvider [] () = @@ -22,7 +22,7 @@ type internal ConvertToAnonymousRecordCodeFixProvider [] ( interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! parseResults = context.Document.GetFSharpParseResultsAsync(nameof ConvertToAnonymousRecordCodeFixProvider) let! sourceText = context.GetSourceTextAsync() let! errorRange = context.GetErrorRangeAsync() diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToNotEqualsEqualityExpression.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToNotEqualsEqualityExpression.fs index bd1cb14821b..3d696f5aa97 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToNotEqualsEqualityExpression.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToNotEqualsEqualityExpression.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -8,7 +8,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal ConvertToNotEqualsEqualityExpressionCodeFixProvider() = @@ -22,7 +22,7 @@ type internal ConvertToNotEqualsEqualityExpressionCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! text = context.GetSquigglyTextAsync() if text <> "!=" then diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToSingleEqualsEqualityExpression.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToSingleEqualsEqualityExpression.fs index cf4238891b7..d791ff6298d 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToSingleEqualsEqualityExpression.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ConvertToSingleEqualsEqualityExpression.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -8,7 +8,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal ConvertToSingleEqualsEqualityExpressionCodeFixProvider() = @@ -22,7 +22,7 @@ type internal ConvertToSingleEqualsEqualityExpressionCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! text = context.GetSquigglyTextAsync() if text <> "==" then diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/DiscardUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFixes/DiscardUnusedValue.fs index efb32d43e71..d2b38baca1c 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/DiscardUnusedValue.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/DiscardUnusedValue.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -12,7 +12,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.Symbols -open CancellableTasks +open Internal.Utilities.Library [] type internal RenameUnusedValueWithUnderscoreCodeFixProvider [] () = @@ -34,7 +34,7 @@ type internal RenameUnusedValueWithUnderscoreCodeFixProvider [] type internal RemoveDotFromIndexerAccessOptInCodeFixProvider() = @@ -27,7 +27,7 @@ type internal RemoveDotFromIndexerAccessOptInCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - CancellableTask.singleton ( + Async2.fromValue ( ValueSome { Name = CodeFix.RemoveIndexerDotBeforeBracket diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/FixIndexerAccessLegacy.fs b/vsintegration/src/FSharp.Editor/CodeFixes/FixIndexerAccessLegacy.fs index aefd2df9ebd..19874d7d184 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/FixIndexerAccessLegacy.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/FixIndexerAccessLegacy.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.Diagnostics -open CancellableTasks +open Internal.Utilities.Library [] type internal LegacyFixAddDotToIndexerAccessCodeFixProvider() = @@ -23,7 +23,7 @@ type internal LegacyFixAddDotToIndexerAccessCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let span, replacement = diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/IFSharpCodeFix.fs b/vsintegration/src/FSharp.Editor/CodeFixes/IFSharpCodeFix.fs index 8b64382095e..572525d184e 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/IFSharpCodeFix.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/IFSharpCodeFix.fs @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.Text -open CancellableTasks +open Internal.Utilities.Library type FSharpCodeFix = { @@ -16,8 +16,8 @@ type FSharpCodeFix = /// Provider can generate at most 1 suggestion. type IFSharpCodeFixProvider = - abstract member GetCodeFixIfAppliesAsync: context: CodeFixContext -> CancellableTask + abstract member GetCodeFixIfAppliesAsync: context: CodeFixContext -> Async2 /// Provider can generate multiple suggestions. type IFSharpMultiCodeFixProvider = - abstract member GetCodeFixesAsync: context: CodeFixContext -> CancellableTask + abstract member GetCodeFixesAsync: context: CodeFixContext -> Async2 diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index 92f0c0077d7..c23651f0455 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -19,7 +19,7 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open FSharp.Compiler.Tokenization -open CancellableTasks +open Internal.Utilities.Library [] type internal InterfaceState = @@ -126,7 +126,7 @@ type internal ImplementInterfaceCodeFixProvider [] () = (sourceText: SourceText, results: FSharpCheckFileResults, state: InterfaceState, displayContext, entity, indentSize) = if InterfaceStubGenerator.HasNoInterfaceMember entity then - CancellableTask.singleton Seq.empty + Async2.fromValue Seq.empty else let membersAndRanges = InterfaceStubGenerator.GetMemberNameAndRanges state.InterfaceData @@ -143,7 +143,7 @@ type internal ImplementInterfaceCodeFixProvider [] () = let lineStr = sourceText.Lines[range.EndLine - 1].ToString() results.GetSymbolUseAtLocation(range.EndLine, range.EndColumn, lineStr, [ name ]) - cancellableTask { + async2 { let! implementedMemberSignatures = InterfaceStubGenerator.GetImplementedMemberSignatures getMemberByLocation displayContext state.InterfaceData @@ -165,7 +165,7 @@ type internal ImplementInterfaceCodeFixProvider [] () = } else - CancellableTask.singleton Seq.empty + Async2.fromValue Seq.empty override _.FixableDiagnosticIds = ImmutableArray.Create "FS0366" @@ -173,8 +173,8 @@ type internal ImplementInterfaceCodeFixProvider [] () = interface IFSharpMultiCodeFixProvider with member _.GetCodeFixesAsync context = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! parseResults, checkFileResults = context.Document.GetFSharpParseAndCheckResultsAsync(nameof ImplementInterfaceCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MakeDeclarationMutable.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MakeDeclarationMutable.fs index 307b8ad0be1..ea9232b6fc0 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MakeDeclarationMutable.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MakeDeclarationMutable.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -10,7 +10,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.EditorServices -open CancellableTasks +open Internal.Utilities.Library [] type internal MakeDeclarationMutableCodeFixProvider [] () = @@ -24,7 +24,7 @@ type internal MakeDeclarationMutableCodeFixProvider [] () interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let document = context.Document if isSignatureFile document.FilePath then diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs index 267832a1aff..9afc554dc89 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal MakeOuterBindingRecursiveCodeFixProvider [] () = @@ -21,7 +21,7 @@ type internal MakeOuterBindingRecursiveCodeFixProvider [] interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! parseResults = context.Document.GetFSharpParseResultsAsync(nameof MakeOuterBindingRecursiveCodeFixProvider) let! sourceText = context.GetSourceTextAsync() let! diagnosticRange = context.GetErrorRangeAsync() diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MissingReference.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MissingReference.fs index eb77d13c355..b9b700282bb 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MissingReference.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MissingReference.fs @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.CodeActions -open CancellableTasks +open Internal.Utilities.Library type private ReferenceType = | AddProjectRef of ProjectReference @@ -36,7 +36,7 @@ type internal MissingReferenceCodeFixProvider() = CodeAction.Create( title, (fun cancellationToken -> - cancellableTask { + async2 { let project = context.Document.Project let solution = project.Solution @@ -51,13 +51,13 @@ type internal MissingReferenceCodeFixProvider() = let newReferences = references |> Seq.append [ metadataRef ] return solution.WithProjectMetadataReferences(project.Id, newReferences) } - |> CancellableTask.start cancellationToken) + |> Async2.startInThreadPool cancellationToken) ) override _.FixableDiagnosticIds = ImmutableArray.Create "FS0074" override _.RegisterCodeFixesAsync context = - cancellableTask { + async2 { let solution = context.Document.Project.Solution let diagnostic = context.Diagnostics[0] @@ -99,4 +99,4 @@ type internal MissingReferenceCodeFixProvider() = | ValueNone -> () | _ -> () } - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/PrefixUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFixes/PrefixUnusedValue.fs index 4f4e6c56600..5da0938e169 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/PrefixUnusedValue.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/PrefixUnusedValue.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -10,7 +10,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal PrefixUnusedValueWithUnderscoreCodeFixProvider [] () = @@ -32,7 +32,7 @@ type internal PrefixUnusedValueWithUnderscoreCodeFixProvider [] type internal ProposeUppercaseLabelCodeFixProvider [] () = @@ -23,7 +23,7 @@ type internal ProposeUppercaseLabelCodeFixProvider [] () = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! errorText = context.GetSquigglyTextAsync() // probably not the 100% robust way to do that diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs index ec376552709..0da5afd9e3c 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -8,7 +8,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal RemoveReturnOrYieldCodeFixProvider [] () = @@ -20,7 +20,7 @@ type internal RemoveReturnOrYieldCodeFixProvider [] () = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! parseResults = context.Document.GetFSharpParseResultsAsync(nameof RemoveReturnOrYieldCodeFixProvider) let! sourceText = context.GetSourceTextAsync() diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveSuperfluousCaptureForUnionCaseWithNoData.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveSuperfluousCaptureForUnionCaseWithNoData.fs index 6c7a50b7e15..637e6a6c107 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveSuperfluousCaptureForUnionCaseWithNoData.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveSuperfluousCaptureForUnionCaseWithNoData.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.EditorServices -open CancellableTasks +open Internal.Utilities.Library [] type internal RemoveSuperfluousCaptureForUnionCaseWithNoDataCodeFixProvider [] () = @@ -31,7 +31,7 @@ type internal RemoveSuperfluousCaptureForUnionCaseWithNoDataCodeFixProvider [] module private Patterns = @@ -118,7 +118,7 @@ type internal FSharpRemoveUnnecessaryParenthesesCodeFixProvider [= 3) // (…) - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let txt = sourceText.ToString(TextSpan(context.Span.Start, context.Span.Length)) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedBinding.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedBinding.fs index 3bd5b54909e..86725e8c867 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedBinding.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedBinding.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -10,7 +10,7 @@ open System.Collections.Immutable open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes -open CancellableTasks +open Internal.Utilities.Library [] type internal RemoveUnusedBindingCodeFixProvider [] () = @@ -31,8 +31,8 @@ type internal RemoveUnusedBindingCodeFixProvider [] () = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { - let! token = CancellableTask.getCancellationToken () + async2 { + let! token = Async2.CancellationToken let! sourceText = context.Document.GetTextAsync token let! parseResults = context.Document.GetFSharpParseResultsAsync(nameof RemoveUnusedBindingCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedOpens.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedOpens.fs index ab24ba7faf0..1cb5b00b985 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedOpens.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveUnusedOpens.fs @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library [] type internal RemoveUnusedOpensCodeFixProvider [] () = @@ -28,7 +28,7 @@ type internal RemoveUnusedOpensCodeFixProvider [] () = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let! unusedOpensOpt = UnusedOpensDiagnosticAnalyzer.GetUnusedOpenRanges context.Document diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs index c8f25ae749d..c8e8d79948a 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs @@ -14,7 +14,7 @@ open Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers open FSharp.Compiler.Diagnostics open FSharp.Compiler.Tokenization.FSharpKeywords -open CancellableTasks +open Internal.Utilities.Library [] type internal RenameParamToMatchSignatureCodeFixProvider [] () = @@ -36,7 +36,7 @@ type internal RenameParamToMatchSignatureCodeFixProvider [ interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let! sourceText = context.GetSourceTextAsync() let suggestionOpt = getSuggestion context.Diagnostics[0] diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ReplaceWithSuggestion.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ReplaceWithSuggestion.fs index 1678f89c1d5..681f5a0e893 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ReplaceWithSuggestion.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ReplaceWithSuggestion.fs @@ -13,7 +13,7 @@ open FSharp.Compiler.Diagnostics open FSharp.Compiler.EditorServices open FSharp.Compiler.Syntax -open CancellableTasks +open Internal.Utilities.Library [] type internal ReplaceWithSuggestionCodeFixProvider [] () = @@ -29,7 +29,7 @@ type internal ReplaceWithSuggestionCodeFixProvider [] () = interface IFSharpMultiCodeFixProvider with member _.GetCodeFixesAsync context = - cancellableTask { + async2 { let! parseFileResults, checkFileResults = context.Document.GetFSharpParseAndCheckResultsAsync(nameof ReplaceWithSuggestionCodeFixProvider) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/SimplifyName.fs b/vsintegration/src/FSharp.Editor/CodeFixes/SimplifyName.fs index 6969f300715..28ec45417c7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/SimplifyName.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/SimplifyName.fs @@ -9,7 +9,7 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics -open CancellableTasks +open Internal.Utilities.Library [] type internal SimplifyNameCodeFixProvider() = @@ -24,7 +24,7 @@ type internal SimplifyNameCodeFixProvider() = interface IFSharpCodeFixProvider with member _.GetCodeFixIfAppliesAsync context = - cancellableTask { + async2 { let propertyBag = context.Diagnostics[0].Properties let title = diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/UseMutationWhenValueIsMutable.fs b/vsintegration/src/FSharp.Editor/CodeFixes/UseMutationWhenValueIsMutable.fs index 9b4ee1721e0..55f8d4bdb40 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/UseMutationWhenValueIsMutable.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/UseMutationWhenValueIsMutable.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis.CodeFixes open FSharp.Compiler.Symbols -open CancellableTasks +open Internal.Utilities.Library [] type internal UseMutationWhenValueIsMutableCodeFixProvider [] () = @@ -25,7 +25,7 @@ type internal UseMutationWhenValueIsMutableCodeFixProvider [] type internal UseTripleQuotedInterpolationCodeFixProvider [] () = @@ -22,7 +22,7 @@ type internal UseTripleQuotedInterpolationCodeFixProvider [] type internal WrapExpressionInParenthesesCodeFixProvider() = @@ -33,4 +33,4 @@ type internal WrapExpressionInParenthesesCodeFixProvider() = ] } - CancellableTask.singleton (ValueSome codeFix) + Async2.fromValue (ValueSome codeFix) diff --git a/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs b/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs index eefb7eab8df..7582c46da2d 100644 --- a/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/HelpContextService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -14,15 +14,15 @@ open FSharp.Compiler.EditorServices open FSharp.Compiler.Syntax open FSharp.Compiler.Text open Microsoft.CodeAnalysis -open CancellableTasks +open Internal.Utilities.Library [] [, FSharpConstants.FSharpLanguageName)>] type internal FSharpHelpContextService [] () = - static member GetHelpTerm(document: Document, span: TextSpan, tokens: List) : CancellableTask = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + static member GetHelpTerm(document: Document, span: TextSpan, tokens: List) : Async2 = + async2 { + let! cancellationToken = Async2.CancellationToken let! _, check = document.GetFSharpParseAndCheckResultsAsync(nameof (FSharpHelpContextService)) let! sourceText = document.GetTextAsync(cancellationToken) @@ -108,8 +108,8 @@ type internal FSharpHelpContextService [] () = member _.Product = FSharpConstants.FSharpLanguageLongName member _.GetHelpTermAsync(document, textSpan, cancellationToken) = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) let defines, langVersion, strictIndentation = document.GetFsharpParsingOptions() @@ -132,6 +132,6 @@ type internal FSharpHelpContextService [] () = return! FSharpHelpContextService.GetHelpTerm(document, textSpan, classifiedSpans) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken member _.FormatSymbol(_symbol) = Unchecked.defaultof<_> diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs index e87fda21539..75895e29cc5 100644 --- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -16,8 +16,7 @@ open Microsoft.VisualStudio.TextManager.Interop open Microsoft.VisualStudio.LanguageServices open Microsoft.VisualStudio.Utilities open FSharp.Compiler.EditorServices -open CancellableTasks.CancellableTaskBuilder -open CancellableTasks +open Internal.Utilities.Library type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, workspace: VisualStudioWorkspace) = @@ -67,14 +66,11 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w wpfTextView.Caret.Position.BufferPosition.GetContainingLine().LineNumber let! document = getLastDocument () - let! cancellationToken = Async.CancellationToken |> liftAsync + let! cancellationToken = Async2.CancellationToken |> liftAsync let! sourceText = document.GetTextAsync(cancellationToken) let! parseResults = - document.GetFSharpParseResultsAsync(nameof (XmlDocCommandFilter)) - |> CancellableTask.start cancellationToken - |> Async.AwaitTask - |> liftAsync + document.GetFSharpParseResultsAsync(nameof (XmlDocCommandFilter)) |> liftAsync let xmlDocables = XmlDocParser.GetXmlDocables(sourceText.ToFSharpSourceText(), parseResults.ParseTree) @@ -130,8 +126,8 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w Assert.Exception ex () } - |> Async.Ignore - |> Async.StartImmediate + |> Async2.Ignore + |> Async2.Start | Some _ | None -> () | _ -> () diff --git a/vsintegration/src/FSharp.Editor/Common/DebugHelpers.fs b/vsintegration/src/FSharp.Editor/Common/DebugHelpers.fs index fa8303b7e60..8910ac4fab4 100644 --- a/vsintegration/src/FSharp.Editor/Common/DebugHelpers.fs +++ b/vsintegration/src/FSharp.Editor/Common/DebugHelpers.fs @@ -1,4 +1,4 @@ -namespace Microsoft.VisualStudio.FSharp.Editor.DebugHelpers +namespace Microsoft.VisualStudio.FSharp.Editor.DebugHelpers open System open System.Diagnostics @@ -31,7 +31,7 @@ open Config open System.Diagnostics.Metrics open System.Text open Microsoft.VisualStudio.Threading -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module FSharpOutputPane = @@ -121,7 +121,7 @@ module FSharpServiceTelemetry = ActivitySource.AddActivityListener(listener) let periodicallyDisplayMetrics = - cancellableTask { + async2 { use _ = CacheMetrics.ListenToAll() use _ = FSharp.Compiler.DiagnosticsLogger.StackGuardMetrics.Listen() diff --git a/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs b/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs index 6c88bc0f912..a7195d74687 100644 --- a/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs +++ b/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs @@ -3,7 +3,8 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System open System.Runtime.Caching open Microsoft.CodeAnalysis -open CancellableTasks +open Internal.Utilities.Library +open Internal.Utilities.Library [] type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolicy: CacheItemPolicy) = @@ -20,8 +21,8 @@ type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolic new DocumentCache<'Value>(name, CacheItemPolicy(SlidingExpiration = (TimeSpan.FromSeconds slidingExpirationSeconds))) member _.TryGetValueAsync(doc: Document) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! currentVersion = doc.GetTextVersionAsync ct match cache.Get(doc.Id.ToString()) with @@ -35,8 +36,8 @@ type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolic } member _.SetAsync(doc: Document, value: 'Value) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! currentVersion = doc.GetTextVersionAsync ct do cache.Set(doc.Id.ToString(), (currentVersion, value), policy) } diff --git a/vsintegration/src/FSharp.Editor/Common/Pervasive.fs b/vsintegration/src/FSharp.Editor/Common/Pervasive.fs index b55f62cc721..1065e3aba4e 100644 --- a/vsintegration/src/FSharp.Editor/Common/Pervasive.fs +++ b/vsintegration/src/FSharp.Editor/Common/Pervasive.fs @@ -4,6 +4,7 @@ module Microsoft.VisualStudio.FSharp.Editor.Pervasive open System open System.IO open System.Diagnostics +open Internal.Utilities.Library /// Checks if the filePath ends with ".fsi" let inline isSignatureFile (filePath: string) = @@ -105,23 +106,23 @@ let maybe = MaybeBuilder() [] type AsyncMaybeBuilder() = [] - member inline _.Return value : Async<'T option> = async.Return(Some value) + member inline _.Return value : Async2<'T option> = Async2.fromValue (Some value) [] - member inline _.ReturnFrom value : Async<'T option> = value + member inline _.ReturnFrom value : Async2<'T option> = value [] - member inline _.ReturnFrom(value: 'T option) : Async<'T option> = async.Return value + member inline _.ReturnFrom(value: 'T option) : Async2<'T option> = Async2.fromValue value [] - member inline _.Zero() : Async = async.Return(Some()) + member inline _.Zero() : Async2 = Async2.fromValue (Some()) [] - member inline _.Delay([] f: unit -> Async<'T option>) : Async<'T option> = async.Delay f + member inline _.Delay([] f: unit -> Async2<'T option>) : Async2<'T option> = async2 { return! f () } [] - member _.Combine(r1, r2: Async<'T option>) : Async<'T option> = - async { + member _.Combine(r1, r2: Async2<'T option>) : Async2<'T option> = + async2 { let! r1' = r1 match r1' with @@ -130,8 +131,8 @@ type AsyncMaybeBuilder() = } [] - member inline _.Bind(value: Async<'T option>, [] f: 'T -> Async<'U option>) : Async<'U option> = - async { + member inline _.Bind(value: Async2<'T option>, [] f: 'T -> Async2<'U option>) : Async2<'U option> = + async2 { let! value' = value match value' with @@ -140,64 +141,72 @@ type AsyncMaybeBuilder() = } [] - member inline _.Bind(value: System.Threading.Tasks.Task<'T>, [] f: 'T -> Async<'U option>) : Async<'U option> = - async { + member inline _.Bind(value: System.Threading.Tasks.Task<'T>, [] f: 'T -> Async2<'U option>) : Async2<'U option> = + async2 { let! value' = Async.AwaitTask value return! f value' } [] - member inline _.Bind(value: 'T option, [] f: 'T -> Async<'U option>) : Async<'U option> = - async { + member inline _.Bind(value: 'T option, [] f: 'T -> Async2<'U option>) : Async2<'U option> = + async2 { match value with | None -> return None | Some result -> return! f result } [] - member inline _.Bind(value: 'T voption, [] f: 'T -> Async<'U option>) : Async<'U option> = - async { + member inline _.Bind(value: 'T voption, [] f: 'T -> Async2<'U option>) : Async2<'U option> = + async2 { match value with | ValueNone -> return None | ValueSome result -> return! f result } [] - member inline _.Using(resource: ('T :> IDisposable), [] body: 'T -> Async<'U option>) : Async<'U option> = - async { + member inline _.Using(resource: ('T :> IDisposable), [] body: 'T -> Async2<'U option>) : Async2<'U option> = + async2 { use resource = resource return! body resource } [] - member x.While(guard, body: Async<_ option>) : Async<_ option> = + member x.While(guard, body: Async2<_ option>) : Async2<_ option> = if guard () then x.Bind(body, (fun () -> x.While(guard, body))) else x.Zero() [] - member inline x.For(sequence: seq<_>, [] body: 'T -> Async) : Async = + member inline x.For(sequence: seq<_>, [] body: 'T -> Async2) : Async2 = x.Using(sequence.GetEnumerator(), (fun enum -> x.While(enum.MoveNext, x.Delay(fun () -> body enum.Current)))) [] - member inline _.TryWith(computation: Async<'T option>, catchHandler: exn -> Async<'T option>) : Async<'T option> = - async.TryWith(computation, catchHandler) + member inline _.TryWith(computation: Async2<'T option>, catchHandler: exn -> Async2<'T option>) : Async2<'T option> = + async2 { + try + return! computation + with ex -> + return! catchHandler ex + } [] - member inline _.TryFinally(computation: Async<'T option>, compensation: unit -> unit) : Async<'T option> = - async.TryFinally(computation, compensation) + member inline _.TryFinally(computation: Async2<'T option>, compensation: unit -> unit) : Async2<'T option> = + async2 { + try + return! computation + finally + compensation () + } let asyncMaybe = AsyncMaybeBuilder() -let inline liftAsync (computation: Async<'T>) : Async<'T option> = - async { +let inline liftAsync computation : Async2<'T option> = + async2 { let! a = computation return Some a } -let liftTaskAsync task = task |> Async.AwaitTask |> liftAsync - module Array = /// Returns a new array with an element replaced with a given value. let replace index value (array: _[]) = diff --git a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs index eb951181241..1567b8c4ca1 100644 --- a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs +++ b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs @@ -110,74 +110,6 @@ module internal RoslynHelpers = member _.Proceed = not isStopped member _.Stop() = isStopped <- true - // This is like Async.StartAsTask, but - // 1. If cancellation occurs we explicitly associate the cancellation with cancellationToken - // 2. If exception occurs then set result to Unchecked.defaultof<_>, i.e. swallow exceptions - // and hope that Roslyn copes with the null - // 3. Never, ever run the computation on the UI thread - switch to thread pool if necessary - // This is because Roslyn makes blocking invocations of tasks from the UI thread at - // several points, and relies on those tasks completing in the thread pool if necessary. - // See for example https://github.com/dotnet/fsharp/issues/11946#issuecomment-896071454 - // Note that no async { ... } code in FSharp.Editor is ever intended to run on the UI - // thread in any form. That is, our async code in FSharp.Editor is always "backgroundAsync" - // in the sense that it is valid switch away from the UI thread if it is ever started on - // the UI thread, e.g. see the corresponding backgroundTask { ... } in RFC FS-1097 - - let StartAsyncAsTask (cancellationToken: CancellationToken) computation = - // Protect against blocking the UI thread by switching to thread pool - let computation = - match SynchronizationContext.Current with - | null -> computation - | _ -> - async { - do! Async.SwitchToThreadPool() - return! computation - } - - let tcs = new TaskCompletionSource<_>(TaskCreationOptions.None) - let barrier = VolatileBarrier() - - let reg = - cancellationToken.Register(fun _ -> - if barrier.Proceed then - tcs.TrySetCanceled(cancellationToken) |> ignore) - - let task = tcs.Task - - let disposeReg () = - barrier.Stop() - - if not task.IsCanceled then - reg.Dispose() - - Async.StartWithContinuations( - computation, - continuation = - (fun result -> - disposeReg () - tcs.TrySetResult(result) |> ignore), - exceptionContinuation = - (fun exn -> - disposeReg () - - match exn with - | :? OperationCanceledException -> tcs.TrySetCanceled(cancellationToken) |> ignore - | exn -> - System.Diagnostics.Trace.TraceError("Visual F# Tools: exception swallowed and not passed to Roslyn: {0}", exn) - let res = Unchecked.defaultof<_> - tcs.TrySetResult(res) |> ignore), - cancellationContinuation = - (fun _oce -> - disposeReg () - tcs.TrySetCanceled(cancellationToken) |> ignore), - cancellationToken = cancellationToken - ) - - task - - let StartAsyncUnitAsTask cancellationToken (computation: Async) = - StartAsyncAsTask cancellationToken computation :> Task - let ConvertError (error: FSharpDiagnostic, location: Location) = // Normalize the error message into the same format that we will receive it from the compiler. // This ensures that IntelliSense and Compiler errors in the 'Error List' are de-duplicated. diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs index fa7db6ec835..4822c95e1d5 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -21,7 +21,7 @@ open FSharp.Compiler.EditorServices open FSharp.Compiler.Syntax open FSharp.Compiler.Text open FSharp.Compiler.Tokenization -open CancellableTasks +open Internal.Utilities.Library module Logger = Microsoft.VisualStudio.FSharp.Editor.Logger @@ -153,8 +153,8 @@ type internal FSharpCompletionProvider genBodyForOverriddenMeth: bool ) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("ProvideCompletionsAsyncAux") @@ -317,11 +317,11 @@ type internal FSharpCompletionProvider ) override _.ProvideCompletionsAsync(context: Completion.CompletionContext) = - cancellableTask { + async2 { use _logBlock = Logger.LogBlockMessage context.Document.Name LogEditorFunctionId.Completion_ProvideCompletionsAsync - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let document = context.Document @@ -370,7 +370,7 @@ type internal FSharpCompletionProvider context.AddItems results } - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken override _.GetDescriptionAsync (document: Document, completionItem: Completion.CompletionItem, _cancellationToken: CancellationToken) @@ -408,7 +408,7 @@ type internal FSharpCompletionProvider | false, _ -> Task.FromResult(CompletionDescription.Empty) override _.GetChangeAsync(document, item, _, cancellationToken) : Task = - cancellableTask { + async2 { use _logBlock = Logger.LogBlockMessage document.Name LogEditorFunctionId.Completion_GetChangeAsync @@ -496,4 +496,4 @@ type internal FSharpCompletionProvider return CompletionChange.Create(TextChange(fullChangingSpan, changedText)).WithNewPosition(Nullable(changedSpan.End)) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Completion/HashDirectiveCompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/HashDirectiveCompletionProvider.fs index 4e2b31f3ab4..32901ded006 100644 --- a/vsintegration/src/FSharp.Editor/Completion/HashDirectiveCompletionProvider.fs +++ b/vsintegration/src/FSharp.Editor/Completion/HashDirectiveCompletionProvider.fs @@ -13,6 +13,7 @@ open Microsoft.CodeAnalysis.Completion open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Classification open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion +open Internal.Utilities.Library type internal HashCompletion = { @@ -138,7 +139,7 @@ type internal HashDirectiveCompletionProvider let extension = Path.GetExtension document.FilePath Option.guard (extension = ".fsx" || extension = ".fsscript") - let! ct = liftAsync Async.CancellationToken + let! ct = liftAsync Async2.CancellationToken let! text = document.GetTextAsync(ct) do! Option.guard (isInStringLiteral (text, position)) let line = text.Lines.GetLineFromPosition(position) @@ -184,11 +185,11 @@ type internal HashDirectiveCompletionProvider ) let pathThroughLastSlash = getPathThroughLastSlash (text, position, quotedPathGroup) - let! items = helper.GetItemsAsync(pathThroughLastSlash, ct) |> Async.AwaitTask |> liftAsync + let! items = helper.GetItemsAsync(pathThroughLastSlash, ct) context.AddItems(items) } - |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask context.CancellationToken + |> Async2.Ignore + |> Async2.startAsUnitTask context.CancellationToken override _.IsInsertionTrigger(text, position) = // Bring up completion when the user types a quote (i.e.: #r "), or if they type a slash diff --git a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs index f00deaa9250..b7e716b81c7 100644 --- a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs +++ b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -20,7 +20,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Text.Position open FSharp.Compiler.Text.Range open FSharp.Compiler.Tokenization -open CancellableTasks +open Internal.Utilities.Library type SignatureHelpParameterInfo = { @@ -316,7 +316,7 @@ type internal FSharpSignatureHelpProvider [] (serviceProvi return adjustedColumnInSource } - let! ct = Async.CancellationToken |> liftAsync + let! ct = liftAsync Async2.CancellationToken let! lexerSymbol = Tokenizer.getSymbolAtPosition ( @@ -618,11 +618,9 @@ type internal FSharpSignatureHelpProvider [] (serviceProvi let! parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("ProvideSignatureHelp") - |> CancellableTask.start CancellationToken.None - |> Async.AwaitTask |> liftAsync - let! sourceText = document.GetTextAsync() |> liftTaskAsync + let! sourceText = document.GetTextAsync() let textLines = sourceText.Lines let caretLinePos = textLines.GetLinePosition(caretPosition) @@ -725,7 +723,7 @@ type internal FSharpSignatureHelpProvider [] (serviceProvi None let doWork () = - async { + async2 { let! signatureHelpDataOpt = FSharpSignatureHelpProvider.ProvideSignatureHelp( document, @@ -784,5 +782,5 @@ type internal FSharpSignatureHelpProvider [] (serviceProvi return! doWork () } - |> Async.map Option.toObj - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.map Option.toObj + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs index 425dba181b4..f8cc5330625 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -16,14 +16,14 @@ open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debuggin open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Text open FSharp.Compiler.Text.Position -open CancellableTasks +open Internal.Utilities.Library [)>] type internal FSharpBreakpointResolutionService [] () = static member GetBreakpointLocation(document: Document, textSpan: TextSpan) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync(ct) @@ -50,7 +50,7 @@ type internal FSharpBreakpointResolutionService [] () = member _.ResolveBreakpointAsync (document: Document, textSpan: TextSpan, cancellationToken: CancellationToken) : Task = - cancellableTask { + async2 { let! range = FSharpBreakpointResolutionService.GetBreakpointLocation(document, textSpan) match range with @@ -63,7 +63,7 @@ type internal FSharpBreakpointResolutionService [] () = | ValueNone -> return Unchecked.defaultof<_> | ValueSome span -> return FSharpBreakpointResolutionResult.CreateSpanResult(document, span) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken // FSROSLYNTODO: enable placing breakpoints by when user supplies fully-qualified function names member _.ResolveBreakpointsAsync(_, _, _) : Task> = diff --git a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs index 3d815f92343..b0225a3684d 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -13,7 +13,7 @@ open Microsoft.CodeAnalysis.Classification open FSharp.Compiler.EditorServices open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debugging -open CancellableTasks +open Internal.Utilities.Library [)>] type internal FSharpLanguageDebugInfoService [] () = @@ -52,10 +52,10 @@ type internal FSharpLanguageDebugInfoService [] () = member _.GetDataTipInfoAsync (document: Document, position: int, cancellationToken: CancellationToken) : Task = - cancellableTask { + async2 { let defines, langVersion, strictIndentation = document.GetFsharpParsingOptions() - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) let textSpan = TextSpan.FromBounds(0, sourceText.Length) @@ -80,4 +80,4 @@ type internal FSharpLanguageDebugInfoService [] () = return result } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs index b7f7ed3d4cf..96e55f53408 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -13,7 +13,7 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics open FSharp.Compiler.Diagnostics -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Telemetry [] @@ -55,7 +55,7 @@ type internal FSharpDocumentDiagnosticAnalyzer [] () = } static member GetDiagnostics(document: Document, diagnosticType: DiagnosticsType) = - cancellableTask { + async2 { let eventProps: (string * obj) array = [| @@ -70,7 +70,7 @@ type internal FSharpDocumentDiagnosticAnalyzer [] () = use _eventDuration = TelemetryReporter.ReportSingleEventWithDuration(TelemetryEvents.GetDiagnosticsForDocument, eventProps) - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync(ct) let filePath = document.FilePath @@ -115,7 +115,7 @@ type internal FSharpDocumentDiagnosticAnalyzer [] () = match diagnosticType with | DiagnosticsType.Syntax when document.Project.IsFsharpRemoveParensEnabled -> UnnecessaryParenthesesDiagnosticAnalyzer.GetDiagnostics document - | _ -> CancellableTask.singleton ImmutableArray.Empty + | _ -> Async2.fromValue ImmutableArray.Empty if errors.Count = 0 && unnecessaryParentheses.IsEmpty then return ImmutableArray.Empty @@ -158,7 +158,7 @@ type internal FSharpDocumentDiagnosticAnalyzer [] () = Task.FromResult ImmutableArray.Empty else FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken member _.AnalyzeSemanticsAsync(document: Document, cancellationToken: CancellationToken) : Task> = if @@ -168,4 +168,4 @@ type internal FSharpDocumentDiagnosticAnalyzer [] () = Task.FromResult ImmutableArray.Empty else FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs index 6db264c5938..048d559ed03 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs @@ -13,7 +13,7 @@ open System.Runtime.Caching open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics open FSharp.Compiler.EditorServices open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library type private PerDocumentSavedData = { @@ -43,8 +43,6 @@ type internal SimplifyNameDiagnosticAnalyzer [] () = let! lockObtained = guard.WaitAsync(DefaultTuning.PerDocumentSavedDataSlidingWindow, cancellationToken) - |> Async.AwaitTask - |> liftAsync do! Option.guard lockObtained @@ -58,16 +56,18 @@ type internal SimplifyNameDiagnosticAnalyzer [] () = let! _, checkResults = document.GetFSharpParseAndCheckResultsAsync(nameof (SimplifyNameDiagnosticAnalyzer)) - |> CancellableTask.start cancellationToken - |> Async.AwaitTask |> liftAsync let! result = - SimplifyNames.getSimplifiableNames ( - checkResults, - fun lineNumber -> sourceText.Lines.[Line.toZ lineNumber].ToString() - ) - |> liftAsync + async2 { + let! r = + SimplifyNames.getSimplifiableNames ( + checkResults, + fun lineNumber -> sourceText.Lines.[Line.toZ lineNumber].ToString() + ) + + return Some r + } let mutable diag = ResizeArray() @@ -101,5 +101,5 @@ type internal SimplifyNameDiagnosticAnalyzer [] () = finally guard.Release() |> ignore } - |> Async.map (Option.defaultValue ImmutableArray.Empty) - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.map (Option.defaultValue ImmutableArray.Empty) + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnnecessaryParenthesesDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnnecessaryParenthesesDiagnosticAnalyzer.fs index 07201f8a0a3..812ed97d6f2 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/UnnecessaryParenthesesDiagnosticAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnnecessaryParenthesesDiagnosticAnalyzer.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -12,7 +12,7 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics -open CancellableTasks +open Internal.Utilities.Library // This interface is not defined in Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics // and so we are not currently exporting the type below as an implementation of it @@ -51,8 +51,8 @@ type internal UnnecessaryParenthesesDiagnosticAnalyzer [] static let semaphore = new SemaphoreSlim 3 static member GetDiagnostics(document: Document) = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! textVersion = document.GetTextVersionAsync cancellationToken let textVersionHash = textVersion.GetHashCode() @@ -122,4 +122,4 @@ type internal UnnecessaryParenthesesDiagnosticAnalyzer [] member _.AnalyzeSyntaxAsync(document: Document, cancellationToken: CancellationToken) = UnnecessaryParenthesesDiagnosticAnalyzer.GetDiagnostics document - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs index f8de2140da1..ae36c7a6b9c 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs @@ -10,7 +10,7 @@ open System.Diagnostics open Microsoft.CodeAnalysis open FSharp.Compiler.EditorServices open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics -open CancellableTasks +open Internal.Utilities.Library [)>] type internal UnusedDeclarationsAnalyzer [] () = @@ -25,7 +25,7 @@ type internal UnusedDeclarationsAnalyzer [] () = Threading.Tasks.Task.FromResult(ImmutableArray.Empty) else - cancellableTask { + async2 { do Trace.TraceInformation("{0:n3} (start) UnusedDeclarationsAnalyzer", DateTime.Now.TimeOfDay.TotalSeconds) @@ -40,4 +40,4 @@ type internal UnusedDeclarationsAnalyzer [] () = |> Seq.map (fun m -> Diagnostic.Create(descriptor, RoslynHelpers.RangeToLocation(m, sourceText, document.FilePath))) |> Seq.toImmutableArray } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs index eca26429312..2526791773c 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs @@ -14,17 +14,17 @@ open FSharp.Compiler.EditorServices open FSharp.Compiler.Text open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics -open CancellableTasks +open Internal.Utilities.Library [)>] type internal UnusedOpensDiagnosticAnalyzer [] () = static member GetUnusedOpenRanges(document: Document) = - cancellableTask { + async2 { if not document.Project.IsFSharpCodeFixesUnusedOpensEnabled then return ValueNone else - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync ct let! _, checkResults = document.GetFSharpParseAndCheckResultsAsync(nameof UnusedOpensDiagnosticAnalyzer) @@ -41,7 +41,7 @@ type internal UnusedOpensDiagnosticAnalyzer [] () = if document.Project.IsFSharpMiscellaneousOrMetadata && not document.IsFSharpScript then Tasks.Task.FromResult(ImmutableArray.Empty) else - cancellableTask { + async2 { do Trace.TraceInformation("{0:n3} (start) UnusedOpensAnalyzer", DateTime.Now.TimeOfDay.TotalSeconds) let! sourceText = document.GetTextAsync() let! unusedOpens = UnusedOpensDiagnosticAnalyzer.GetUnusedOpenRanges document @@ -53,4 +53,4 @@ type internal UnusedOpensDiagnosticAnalyzer [] () = Diagnostic.Create(descriptor, RoslynHelpers.RangeToLocation(range, sourceText, document.FilePath))) |> Seq.toImmutableArray } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs index 972f64ad6b3..adf6bec0a03 100644 --- a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs +++ b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs @@ -12,7 +12,7 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.ExternalAccess.FSharp.DocumentHighlighting open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library type internal FSharpHighlightSpan = { @@ -56,8 +56,8 @@ type internal FSharpDocumentHighlightsService [] () = |> Seq.distinctBy (fun span -> span.TextSpan.Start) |> Seq.toArray - static member GetDocumentHighlights(document: Document, position: int) : CancellableTask = - cancellableTask { + static member GetDocumentHighlights(document: Document, position: int) : Async2 = + async2 { let! symbol = document.TryFindFSharpLexerSymbolAsync( position, @@ -70,7 +70,7 @@ type internal FSharpDocumentHighlightsService [] () = match symbol with | None -> return Array.empty | Some symbol -> - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync(ct) let textLine = sourceText.Lines.GetLineFromPosition(position) @@ -112,7 +112,7 @@ type internal FSharpDocumentHighlightsService [] () = member _.GetDocumentHighlightsAsync (document, position, _documentsToSearch, cancellationToken) : Task> = - cancellableTask { + async2 { let! spans = FSharpDocumentHighlightsService.GetDocumentHighlights(document, position) let highlightSpans = @@ -129,4 +129,4 @@ type internal FSharpDocumentHighlightsService [] () = return ImmutableArray.Create(FSharpDocumentHighlights(document, highlightSpans)) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs b/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs index 1b58774e7a1..fd242927b43 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -7,8 +7,7 @@ open Microsoft.CodeAnalysis.Text open FSharp.Compiler.CodeAnalysis open System.Runtime.InteropServices open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor -open CancellableTasks.CancellableTaskBuilder -open CancellableTasks +open Internal.Utilities.Library [)>] type internal FSharpBraceMatchingService [] () = @@ -23,7 +22,7 @@ type internal FSharpBraceMatchingService [] () = userOpName: string, [] forFormatting: bool ) = - async { + async2 { let! matchedBraces = checker.MatchBraces(fileName, sourceText.ToFSharpSourceText(), parsingOptions, userOpName) let isPositionInRange range = @@ -46,8 +45,6 @@ type internal FSharpBraceMatchingService [] () = asyncMaybe { let! checker, _, parsingOptions, _ = document.GetFSharpCompilationOptionsAsync(nameof (FSharpBraceMatchingService)) - |> CancellableTask.start cancellationToken - |> Async.AwaitTask |> liftAsync let! sourceText = document.GetTextAsync(cancellationToken) @@ -66,5 +63,5 @@ type internal FSharpBraceMatchingService [] () = let! rightSpan = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, right) return FSharpBraceMatchingResult(leftSpan, rightSpan) } - |> Async.map Option.toNullable - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.map Option.toNullable + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs index 88aa10e23ab..5196afe5a80 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs @@ -15,6 +15,7 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Tokenization open System.Threading open System.Windows.Forms +open Internal.Utilities.Library [)>] type internal FSharpEditorFormattingService [] (settings: EditorOptions) = @@ -185,9 +186,9 @@ type internal FSharpEditorFormattingService [] (settings: } member _.GetFormattingChangesAsync(document: Document, position: int, cancellationToken: CancellationToken) = - async { - let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask - let! options = document.GetOptionsAsync(cancellationToken) |> Async.AwaitTask + async2 { + let! sourceText = document.GetTextAsync(cancellationToken) + let! options = document.GetOptionsAsync(cancellationToken) let indentStyle = options.GetOption(FormattingOptions.SmartIndent, FSharpConstants.FSharpLanguageName) @@ -210,9 +211,9 @@ type internal FSharpEditorFormattingService [] (settings: } member _.OnPasteAsync(document: Document, span: TextSpan, currentClipboard: string, cancellationToken: CancellationToken) = - async { - let! sourceText = document.GetTextAsync(cancellationToken) |> Async.AwaitTask - let! options = document.GetOptionsAsync(cancellationToken) |> Async.AwaitTask + async2 { + let! sourceText = document.GetTextAsync(cancellationToken) + let! options = document.GetOptionsAsync(cancellationToken) let tabSize = options.GetOption(FormattingOptions.TabSize, FSharpConstants.FSharpLanguageName) @@ -253,19 +254,19 @@ type internal FSharpEditorFormattingService [] (settings: false override _.GetFormattingChangesAsync(_document, _span, cancellationToken) = - async { return ResizeArray() :> IList<_> } - |> RoslynHelpers.StartAsyncAsTask cancellationToken + async2 { return ResizeArray() :> IList<_> } + |> Async2.startAsTask cancellationToken override this.GetFormattingChangesOnPasteAsync(document, span, cancellationToken) = let currentClipboard = Clipboard.GetText() this.OnPasteAsync(document, span, currentClipboard, cancellationToken) - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.startAsTask cancellationToken override this.GetFormattingChangesAsync(document, _typedChar, position, cancellationToken) = this.GetFormattingChangesAsync(document, position, cancellationToken) - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.startAsTask cancellationToken override this.GetFormattingChangesOnReturnAsync(document, position, cancellationToken) = this.GetFormattingChangesAsync(document, position, cancellationToken) - |> RoslynHelpers.StartAsyncAsTask cancellationToken + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Hints/FSharpInlineHintsService.fs b/vsintegration/src/FSharp.Editor/Hints/FSharpInlineHintsService.fs index acdd0fdc97d..81043f219d4 100644 --- a/vsintegration/src/FSharp.Editor/Hints/FSharpInlineHintsService.fs +++ b/vsintegration/src/FSharp.Editor/Hints/FSharpInlineHintsService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints @@ -7,7 +7,7 @@ open System.ComponentModel.Composition open Microsoft.CodeAnalysis.ExternalAccess.FSharp.InlineHints open Microsoft.VisualStudio.FSharp.Editor open Microsoft.VisualStudio.FSharp.Editor.Telemetry -open CancellableTasks +open Internal.Utilities.Library open System.Threading.Tasks // So the Roslyn interface is called IFSharpInlineHintsService @@ -27,18 +27,18 @@ type internal FSharpInlineHintsService [] (settings: Edito if hintKinds.IsEmpty then Task.FromResult ImmutableArray.Empty else - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync cancellationToken let! nativeHints = HintService.getHintsForDocument sourceText document hintKinds userOpName let tasks = nativeHints - |> Seq.map (fun hint -> NativeToRoslynHintConverter.convert sourceText hint cancellationToken) + |> Seq.map (fun hint -> NativeToRoslynHintConverter.convert sourceText hint) - let! roslynHints = Task.WhenAll(tasks) + let! roslynHints = tasks |> Async2.Parallel return roslynHints.ToImmutableArray() } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Hints/HintService.fs b/vsintegration/src/FSharp.Editor/Hints/HintService.fs index 1eb4c4fa373..e06709ba6da 100644 --- a/vsintegration/src/FSharp.Editor/Hints/HintService.fs +++ b/vsintegration/src/FSharp.Editor/Hints/HintService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints @@ -9,7 +9,7 @@ open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor open FSharp.Compiler.Symbols open Hints -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Telemetry module HintService = @@ -40,7 +40,7 @@ module HintService = Seq.concat hints let getHintsForDocument sourceText (document: Document) hintKinds userOpName = - cancellableTask { + async2 { if isSignatureFile document.FilePath then return List.empty else @@ -62,7 +62,7 @@ module HintService = [| ("hints.kinds", hintKindsSerialized); ("cacheHit", false) |] ) - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! parseResults, checkResults = document.GetFSharpParseAndCheckResultsAsync userOpName let nativeHints = diff --git a/vsintegration/src/FSharp.Editor/Hints/Hints.fs b/vsintegration/src/FSharp.Editor/Hints/Hints.fs index 0dd7fbff263..0d56aba1a3c 100644 --- a/vsintegration/src/FSharp.Editor/Hints/Hints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/Hints.fs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints open Microsoft.CodeAnalysis open FSharp.Compiler.Text -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module Hints = @@ -20,7 +20,7 @@ module Hints = Kind: HintKind Range: range Parts: TaggedText list - GetTooltip: Document -> CancellableTask + GetTooltip: Document -> Async2 } let inline serialize kind = diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs index f0712cb8e21..328c7b6f5e2 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints @@ -9,12 +9,12 @@ open FSharp.Compiler.EditorServices open FSharp.Compiler.Symbols open FSharp.Compiler.Text open Hints -open CancellableTasks +open Internal.Utilities.Library type InlineParameterNameHints(parseResults: FSharpParseFileResults) = let getTooltip (symbol: FSharpSymbol) _ = - cancellableTask { + async2 { // This brings little value as of now. Basically just discerns fields from parameters // and fills the tooltip bubble which otherwise looks like a visual glitch. // diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineReturnTypeHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineReturnTypeHints.fs index 1a984df33c7..7c1b93d934e 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineReturnTypeHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineReturnTypeHints.fs @@ -7,7 +7,7 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Symbols open FSharp.Compiler.Text open Hints -open CancellableTasks +open Internal.Utilities.Library type InlineReturnTypeHints(parseFileResults: FSharpParseFileResults, symbol: FSharpMemberOrFunctionOrValue) = @@ -21,7 +21,7 @@ type InlineReturnTypeHints(parseFileResults: FSharpParseFileResults, symbol: FSh ]) let getTooltip _ = - cancellableTask { + async2 { let typeAsString = symbol.ReturnParameter.Type.TypeDefinition.ToString() let text = $"type {typeAsString}" return [ TaggedText(TextTag.Text, text) ] diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineTypeHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineTypeHints.fs index 38c6bda6a2d..7193a6c63ad 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineTypeHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineTypeHints.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints @@ -8,7 +8,7 @@ open FSharp.Compiler.Symbols open FSharp.Compiler.Text open FSharp.Compiler.Text.Position open Hints -open CancellableTasks +open Internal.Utilities.Library type InlineTypeHints(parseResults: FSharpParseFileResults, symbol: FSharpMemberOrFunctionOrValue) = @@ -23,7 +23,7 @@ type InlineTypeHints(parseResults: FSharpParseFileResults, symbol: FSharpMemberO | None -> [] let getTooltip _ = - cancellableTask { + async2 { // Done this way because I am not sure if we want to show full-blown types everywhere, // e.g. Microsoft.FSharp.Core.string instead of string. // On the other hand, for user types this could be useful. diff --git a/vsintegration/src/FSharp.Editor/Hints/NativeToRoslynHintConverter.fs b/vsintegration/src/FSharp.Editor/Hints/NativeToRoslynHintConverter.fs index 61442b6b547..dda38c06ece 100644 --- a/vsintegration/src/FSharp.Editor/Hints/NativeToRoslynHintConverter.fs +++ b/vsintegration/src/FSharp.Editor/Hints/NativeToRoslynHintConverter.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.Hints @@ -10,7 +10,7 @@ open Microsoft.VisualStudio.FSharp.Editor open Microsoft.CodeAnalysis open FSharp.Compiler.Text open Hints -open CancellableTasks +open Internal.Utilities.Library module NativeToRoslynHintConverter = @@ -27,13 +27,13 @@ module NativeToRoslynHintConverter = let convert sourceText hint = let getDescriptionAsync (doc: Document) (ct: CancellationToken) = - cancellableTask { + async2 { let! taggedText = hint.GetTooltip doc return taggedText |> List.map nativeToRoslynText |> ImmutableArray.CreateRange } - |> CancellableTask.start ct + |> Async2.startInThreadPool ct - cancellableTask { + async2 { let span = rangeToSpan hint.Range sourceText let displayParts = hint.Parts |> Seq.map nativeToRoslynText diff --git a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs index 8a5debfdc84..e4a839a371a 100644 --- a/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs +++ b/vsintegration/src/FSharp.Editor/InlineRename/InlineRenameService.fs @@ -18,7 +18,7 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Symbols open FSharp.Compiler.Text open FSharp.Compiler.Tokenization -open CancellableTasks +open Internal.Utilities.Library type internal InlineRenameReplacementInfo(newSolution: Solution, replacementTextValid: bool, documentIds: IEnumerable) = inherit FSharpInlineRenameReplacementInfo() @@ -38,8 +38,8 @@ type internal InlineRenameLocationSet (solution: Solution) (locationsByDocument: (Document * FSharpInlineRenameLocation list) list) = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken match locationsByDocument with | [] -> return solution @@ -56,7 +56,7 @@ type internal InlineRenameLocationSet override _.GetReplacementsAsync(replacementText, cancellationToken) : Task = - cancellableTask { + async2 { let! newSolution = applyChanges replacementText originalSolution (locations |> Array.toList |> List.groupBy (fun x -> x.Document)) @@ -73,7 +73,7 @@ type internal InlineRenameLocationSet let documentIds = locations |> Seq.map (fun doc -> doc.Document.Id) |> Seq.distinct return new InlineRenameReplacementInfo(newSolution, replacementTextValid, documentIds) :> FSharpInlineRenameReplacementInfo } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken type internal InlineRenameInfo ( @@ -82,23 +82,22 @@ type internal InlineRenameInfo sourceText: SourceText, lexerSymbol: LexerSymbol, symbolUse: FSharpSymbolUse, - checkFileResults: FSharpCheckFileResults, - ct: CancellationToken + checkFileResults: FSharpCheckFileResults ) = inherit FSharpInlineRenameInfo() let getDocumentText (document: Document) = match document.TryGetText() with - | true, text -> CancellableTask.singleton text + | true, text -> Async2.fromValue text | _ -> - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken return! document.GetTextAsync(cancellationToken) } let symbolUses = - SymbolHelpers.getSymbolUsesInSolution (symbolUse, checkFileResults, document) ct + SymbolHelpers.getSymbolUsesInSolution (symbolUse, checkFileResults, document) let symbolDisplayName = symbolUse.Symbol.DisplayName @@ -127,7 +126,7 @@ type internal InlineRenameInfo sourceText else let textTask = getDocumentText location.Document - CancellableTask.runSynchronously cancellationToken textTask + Async2.run cancellationToken textTask Tokenizer.fixupSpan (text, location.TextSpan) @@ -137,7 +136,7 @@ type internal InlineRenameInfo sourceText else let textTask = getDocumentText location.Document - CancellableTask.runSynchronously cancellationToken textTask + Async2.run cancellationToken textTask let spanText = text.ToString(location.TextSpan) let position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal) @@ -148,15 +147,15 @@ type internal InlineRenameInfo Nullable(TextSpan(location.TextSpan.Start + position, replacementText.Length)) override _.FindRenameLocationsAsync(_, _, cancellationToken) = - cancellableTask { + async2 { let! symbolUsesByDocumentId = symbolUses let! results = seq { for (KeyValue(documentId, symbolUses)) in symbolUsesByDocumentId do - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let document = document.Project.Solution.GetDocument(documentId) let! sourceText = document.GetTextAsync(cancellationToken) @@ -169,7 +168,7 @@ type internal InlineRenameInfo |] } } - |> CancellableTask.whenAll + |> Async2.whenAll let locations = Array.concat results @@ -177,7 +176,7 @@ type internal InlineRenameInfo InlineRenameLocationSet(locations, document.Project.Solution, lexerSymbol.Kind, symbolUse.Symbol) :> FSharpInlineRenameLocationSet } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken [); Shared>] type internal InlineRenameService [] () = @@ -185,8 +184,8 @@ type internal InlineRenameService [] () = inherit FSharpInlineRenameServiceImplementation() override _.GetRenameInfoAsync(document: Document, position: int, cancellationToken: CancellationToken) : Task = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync(ct) let textLine = sourceText.Lines.GetLineFromPosition(position) let textLinePos = sourceText.Lines.GetLinePosition(position) @@ -218,11 +217,11 @@ type internal InlineRenameService [] () = match textSpan with | Tokenizer.FixedSpan sourceText symbolUse.Symbol.DisplayName triggerSpan -> let result = - InlineRenameInfo(document, triggerSpan, sourceText, symbol, symbolUse, checkFileResults, ct) + InlineRenameInfo(document, triggerSpan, sourceText, symbol, symbolUse, checkFileResults) return result :> FSharpInlineRenameInfo | _ -> // #18270: Abort if user clicked on phantom get/set accessor keyword return Unchecked.defaultof<_> } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpAnalysisSaveFileCommandHandler.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpAnalysisSaveFileCommandHandler.fs index 7834c95f562..98a51a5cab5 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpAnalysisSaveFileCommandHandler.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpAnalysisSaveFileCommandHandler.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -12,7 +12,7 @@ open Microsoft.VisualStudio.FSharp.Editor.DebugHelpers open Microsoft.VisualStudio.Text.Editor.Commanding.Commands open Microsoft.VisualStudio.Commanding open Microsoft.VisualStudio.Utilities -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Telemetry // This causes re-analysis to happen when a F# document is saved. @@ -51,7 +51,7 @@ type internal FSharpAnalysisSaveFileCommandHandler [] (ana if document.Project.Language <> LanguageNames.FSharp then () else - cancellableTask { + async2 { try let openDocIds = workspace.GetOpenDocumentIds() @@ -92,7 +92,7 @@ type internal FSharpAnalysisSaveFileCommandHandler [] (ana TelemetryReporter.ReportFault(TelemetryEvents.AnalysisSaveFileHandler, e = ex) FSharpOutputPane.logException ex } - |> CancellableTask.startWithoutCancellation + |> Async2.startAsTaskWithoutCancellation |> ignore // fire and forget nextCommandHandler.Invoke() diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index d61ba717b4d..bf27e17e80e 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -15,7 +15,7 @@ open Microsoft.VisualStudio.FSharp.Editor open System.Threading open Microsoft.VisualStudio.FSharp.Interactive.Session open System.Runtime.CompilerServices -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Extensions open System.Windows open Microsoft.VisualStudio @@ -197,8 +197,8 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = fsRefProj let rec tryComputeOptionsBySingleScriptOrFile (document: Document) userOpName = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! fileStamp = document.GetTextVersionAsync(ct) let textViewAndCaret () : (IVsTextView * Position) option = document.TryGetTextViewAndCaretPos() @@ -322,9 +322,9 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = | _ -> ValueNone let rec tryComputeOptions (project: Project) = - cancellableTask { + async2 { let projectId = project.Id - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken match cache.TryGetValue(projectId) with | false, _ -> @@ -434,7 +434,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = | true, (oldProject, parsingOptions, projectOptions) -> if isProjectInvalidated oldProject project ct then cache.TryRemove(projectId) |> ignore - return! tryComputeOptions project ct + return! tryComputeOptions project else return ValueSome(parsingOptions, projectOptions) } @@ -454,7 +454,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = elif document.Project.IsFSharpMiscellaneousOrMetadata then let! options = tryComputeOptionsBySingleScriptOrFile document userOpName - |> CancellableTask.start ct + |> Async2.startInThreadPool ct |> Async.AwaitTask if ct.IsCancellationRequested then @@ -468,7 +468,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = document.Project.Solution.Workspace.CurrentSolution.GetProject(document.Project.Id) if not (isNull project) then - let! options = tryComputeOptions project |> CancellableTask.start ct |> Async.AwaitTask + let! options = tryComputeOptions project |> Async2.startInThreadPool ct |> Async.AwaitTask if ct.IsCancellationRequested then reply.Reply ValueNone @@ -495,7 +495,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let project = project.Solution.Workspace.CurrentSolution.GetProject(project.Id) if not (isNull project) then - let! options = tryComputeOptions project |> CancellableTask.start ct |> Async.AwaitTask + let! options = tryComputeOptions project |> Async2.startInThreadPool ct |> Async.AwaitTask if ct.IsCancellationRequested then reply.Reply ValueNone diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 1dfa6fe4517..c358fb0bbeb 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -24,7 +24,7 @@ open Microsoft.VisualStudio.Text.Outlining open Microsoft.CodeAnalysis.ExternalAccess.FSharp open Microsoft.CodeAnalysis.Host.Mef open Microsoft.VisualStudio.FSharp.Editor.Telemetry -open CancellableTasks +open Internal.Utilities.Library open FSharp.Compiler.Text open Microsoft.VisualStudio.Editor @@ -195,14 +195,14 @@ type internal FSharpWorkspaceServiceFactory if enableLiveBuffers && not useTransparentCompiler then workspace.WorkspaceChanged.Add(fun args -> if args.DocumentId <> null then - cancellableTask { + async2 { let document = args.NewSolution.GetDocument(args.DocumentId) let! _, _, _, options = document.GetFSharpCompilationOptionsAsync(nameof (workspace.WorkspaceChanged)) do! checker.NotifyFileChanged(document.FilePath, options) } - |> CancellableTask.startAsTask CancellationToken.None + |> Async2.startAsUnitTask CancellationToken.None |> ignore) let optionsManager = FSharpProjectOptionsManager(checker, workspace) @@ -334,7 +334,7 @@ type internal FSharpPackage() as this = packageRegistrationTasks.AddTask( true, (fun _tasks cancellationToken -> - foregroundCancellableTask { + async2 { let exportProvider = this.ComponentModel.DefaultExportProvider let theme = exportProvider.GetExport().Value @@ -349,13 +349,13 @@ type internal FSharpPackage() as this = // FSI-LINKAGE-POINT: sited init FSharp.Interactive.Hooks.fsiConsoleWindowPackageInitializeSited (this :> Package) commandService } - |> CancellableTask.startAsTask cancellationToken) + |> Async2.startAsUnitTask cancellationToken) ) packageRegistrationTasks.AddTask( false, (fun _tasks cancellationToken -> - cancellableTask { + async2 { let exportProvider = this.ComponentModel.DefaultExportProvider let workspace = exportProvider.GetExportedValue() @@ -405,7 +405,7 @@ type internal FSharpPackage() as this = globalOptions.BlockForCompletionItems <- false } - |> CancellableTask.startAsTask cancellationToken) + |> Async2.startAsUnitTask cancellationToken) ) #if DEBUG @@ -415,7 +415,7 @@ type internal FSharpPackage() as this = fun _ _ -> task { DebugHelpers.FSharpServiceTelemetry.periodicallyDisplayMetrics - |> CancellableTask.start this.DisposalToken + |> Async2.startInThreadPool this.DisposalToken |> ignore } ) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs index 468298978e1..679bb347695 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs @@ -16,6 +16,7 @@ open FSharp.Compiler.Symbols open FSharp.Compiler.Text open Microsoft.VisualStudio.FSharp.Editor.Telemetry open CancellableTasks +open Internal.Utilities.Library module internal SymbolHelpers = @@ -23,17 +24,15 @@ module internal SymbolHelpers = let getSymbolUsesOfSymbolAtLocationInDocument (document: Document, position: int) = asyncMaybe { let userOpName = "getSymbolUsesOfSymbolAtLocationInDocument" - let! ct = Async.CancellationToken |> liftAsync + let! ct = Async2.CancellationToken |> liftAsync let! _, checkFileResults = document.GetFSharpParseAndCheckResultsAsync(userOpName) - |> CancellableTask.start ct - |> Async.AwaitTask |> liftAsync let! defines, langVersion, strictIndentation = document.GetFsharpParsingOptionsAsync(userOpName) |> liftAsync - let! cancellationToken = Async.CancellationToken |> liftAsync + let! cancellationToken = Async2.CancellationToken |> liftAsync let! sourceText = document.GetTextAsync(cancellationToken) let textLine = sourceText.Lines.GetLineFromPosition(position) let textLinePos = sourceText.Lines.GetLinePosition(position) @@ -62,17 +61,15 @@ module internal SymbolHelpers = symbol.FullIsland ) - let! ct = Async.CancellationToken |> liftAsync - let symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol, cancellationToken = ct) return symbolUses } - let getSymbolUsesInProjects (symbol: FSharpSymbol, projects: Project list, onFound: Document -> range -> CancellableTask) = + let getSymbolUsesInProjects (symbol: FSharpSymbol, projects: Project list, onFound: Document -> range -> Async2) = match projects with - | [] -> CancellableTask.singleton () + | [] -> Async2.fromValue () | firstProject :: _ -> let isFastFindReferencesEnabled = firstProject.IsFastFindReferencesEnabled @@ -80,7 +77,7 @@ module internal SymbolHelpers = let props = [| nameof isFastFindReferencesEnabled, isFastFindReferencesEnabled :> obj |] - cancellableTask { + async2 { // TODO: this needs to be a single event with a duration TelemetryReporter.ReportSingleEvent(TelemetryEvents.GetSymbolUsesInProjectsStarted, props) @@ -90,14 +87,14 @@ module internal SymbolHelpers = projects |> Seq.map (fun project -> project.GetFSharpProjectSnapshot(snapshotAccumulator) - |> CancellableTask.map (fun s -> project, s)) - |> CancellableTask.sequential + |> Async2.map (fun s -> project, s)) + |> Async2.Sequential do! projects |> Seq.map (fun (project, snapshot) -> project.FindFSharpReferencesAsync(symbol, snapshot, onFound, "getSymbolUsesInProjects")) - |> CancellableTask.whenAll + |> Async2.whenAll |> Async2.Ignore TelemetryReporter.ReportSingleEvent(TelemetryEvents.GetSymbolUsesInProjectsFinished, props) } @@ -106,9 +103,9 @@ module internal SymbolHelpers = (symbolUse: FSharpSymbolUse) (currentDocument: Document) (checkFileResults: FSharpCheckFileResults) - (onFound: Document -> range -> CancellableTask) + (onFound: Document -> range -> Async2) = - cancellableTask { + async2 { match symbolUse.GetSymbolScope currentDocument with | Some SymbolScope.CurrentDocument -> @@ -117,7 +114,7 @@ module internal SymbolHelpers = do! symbolUses |> Seq.map (fun symbolUse -> onFound currentDocument symbolUse.Range) - |> CancellableTask.whenAll + |> Async2.whenAll |> Async2.Ignore | Some SymbolScope.SignatureAndImplementation -> let otherFile = getOtherFile currentDocument.FilePath @@ -125,11 +122,11 @@ module internal SymbolHelpers = let! otherFileCheckResults = match currentDocument.Project.Solution.TryGetDocumentFromPath otherFile with | ValueSome doc -> - cancellableTask { + async2 { let! _, checkFileResults = doc.GetFSharpParseAndCheckResultsAsync("findReferencedSymbolsAsync") return [ checkFileResults, doc ] } - | ValueNone -> CancellableTask.singleton [] + | ValueNone -> Async2.fromValue [] let symbolUses = (checkFileResults, currentDocument) :: otherFileCheckResults @@ -137,7 +134,7 @@ module internal SymbolHelpers = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol) |> Seq.map (fun symbolUse -> (doc, symbolUse.Range))) - do! symbolUses |> Seq.map ((<||) onFound) |> CancellableTask.whenAll + do! symbolUses |> Seq.map ((<||) onFound) |> Async2.Parallel |> Async2.Ignore | scope -> let projectsToCheck = @@ -172,11 +169,11 @@ module internal SymbolHelpers = } let getSymbolUses (symbolUse: FSharpSymbolUse) (currentDocument: Document) (checkFileResults: FSharpCheckFileResults) = - cancellableTask { + async2 { let symbolUses = ConcurrentBag() let onFound = - fun document range -> cancellableTask { symbolUses.Add(document, range) } + fun document range -> async2 { symbolUses.Add(document, range) } do! findSymbolUses symbolUse currentDocument checkFileResults onFound @@ -184,7 +181,7 @@ module internal SymbolHelpers = } let getSymbolUsesInSolution (symbolUse: FSharpSymbolUse, checkFileResults: FSharpCheckFileResults, document: Document) = - cancellableTask { + async2 { let! symbolUses = getSymbolUses symbolUse document checkFileResults let symbolUsesWithDocumentId = diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 862aa064685..e809ee8ede7 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -12,8 +12,6 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.CodeAnalysis.ProjectSnapshot open FSharp.Compiler.Symbols -open CancellableTasks - open System.IO open Internal.Utilities.Collections @@ -158,6 +156,8 @@ module internal FSharpProjectSnapshotSerialization = open FSharpProjectSnapshotSerialization open System.Collections.Concurrent +open Internal.Utilities.Library +open FSharp.Compiler.Text [] module private CheckerExtensions = @@ -173,11 +173,11 @@ module private CheckerExtensions = raise (OperationCanceledException("Project is not a FSharp project.")) else match ProjectCache.Projects.TryGetValue(this) with - | true, result -> CancellableTask.singleton result + | true, result -> Async2.fromValue result | _ -> - cancellableTask { + async2 { - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let service = this.Solution.GetFSharpWorkspaceService() let projectOptionsManager = service.FSharpProjectOptionsManager @@ -192,7 +192,7 @@ module private CheckerExtensions = } let documentToSnapshot (document: Document) = - cancellableTask { + async2 { let! version = document.GetTextVersionAsync() let getSource () = @@ -206,9 +206,12 @@ module private CheckerExtensions = let getReferencedProjectVersions (project: Project) = project.GetAllProjectsThisProjectDependsOn() - |> Seq.map (fun r ct -> r.GetDependentSemanticVersionAsync(ct)) - |> CancellableTask.whenAll - |> CancellableTask.map (Seq.map (fun x -> x.ToString()) >> Set) + |> Seq.map (fun r -> async2 { + let! ct = Async2.CancellationToken + return! r.GetDependentSemanticVersionAsync(ct) + }) + |> Async2.whenAll + |> Async2.map (Seq.map (fun x -> x.ToString()) >> Set) let getOnDiskReferences (options: FSharpProjectOptions) = options.OtherOptions @@ -223,13 +226,13 @@ module private CheckerExtensions = |> Seq.toList let createProjectSnapshot (snapshotAccumulatorOpt) (project: Project) (options: FSharpProjectOptions option) = - cancellableTask { + async2 { let! options = match options with - | Some options -> CancellableTask.singleton options + | Some options -> Async2.fromValue options | None -> - cancellableTask { + async2 { let! _, _, _, options = getFSharpOptionsForProject project return options } @@ -251,7 +254,7 @@ module private CheckerExtensions = None | true, (true, (_, oldProjectVersion, _, _, oldSnapshot: FSharpProjectSnapshot)) when projectVersion = oldProjectVersion -> - Some(CancellableTask.singleton oldSnapshot) + Some(Async2.fromValue oldSnapshot) | true, (true, (oldProject, _oldProjectVersion, _oldReferencesVersion, oldOptions, oldSnapshot: FSharpProjectSnapshot)) when FSharpProjectOptions.AreSameForChecking(options, oldOptions) @@ -286,8 +289,8 @@ module private CheckerExtensions = changedDocuments |> Seq.map (project.GetDocument >> documentToSnapshot) - |> CancellableTask.whenAll - |> CancellableTask.map (Array.toList >> oldSnapshot.Replace) + |> Async2.whenAll + |> Async2.map (Array.toList >> oldSnapshot.Replace) |> Some | _ -> None @@ -297,7 +300,7 @@ module private CheckerExtensions = match updatedSnapshot with | Some snapshot -> snapshot | _ -> - cancellableTask { + async2 { let solution = project.Solution @@ -375,15 +378,9 @@ module private CheckerExtensions = member _.GetLabel() = project.FilePath } - snapshotCache.GetAsync( + snapshotCache.Get( key, - async { - let! ct = Async.CancellationToken - - return! - createProjectSnapshot snapshotAccumulatorOpt project options ct - |> Async.AwaitTask - } + createProjectSnapshot snapshotAccumulatorOpt project options ) let getProjectSnapshotForDocument (document: Document, options: FSharpProjectOptions) = @@ -393,15 +390,16 @@ module private CheckerExtensions = /// Parse the source text from the Roslyn document. member checker.ParseDocument(document: Document, parsingOptions: FSharpParsingOptions, userOpName: string) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () - let! sourceText = document.GetTextAsync(ct) + async2 { + let! ct = Async2.CancellationToken + // TODO: investigate why the annotation is needed here. + let! sourceText : Text.SourceText = document.GetTextAsync(ct) return! checker.ParseFile(document.FilePath, sourceText.ToFSharpSourceText(), parsingOptions, userOpName = userOpName) } member checker.ParseDocumentUsingTransparentCompiler(document: Document, options: FSharpProjectOptions, userOpName: string) = - cancellableTask { + async2 { let! projectSnapshot = getProjectSnapshotForDocument (document, options) return! checker.ParseFile(document.FilePath, projectSnapshot, userOpName = userOpName) } @@ -409,7 +407,7 @@ module private CheckerExtensions = member checker.ParseAndCheckDocumentUsingTransparentCompiler (document: Document, options: FSharpProjectOptions, userOpName: string) = - cancellableTask { + async2 { checker.TransparentCompiler.SetCacheSizeFactor(document.Project.TransparentCompilerCacheFactor) @@ -427,17 +425,18 @@ module private CheckerExtensions = member checker.ParseAndCheckDocumentWithPossibleStaleResults (document: Document, options: FSharpProjectOptions, allowStaleResults: bool, userOpName: string) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken - let! sourceText = document.GetTextAsync(ct) + // TODO: investigate why the annotation is needed here. + let! sourceText: Text.SourceText = document.GetTextAsync(ct) let! textVersion = document.GetTextVersionAsync(ct) let filePath = document.FilePath let textVersionHash = textVersion.GetHashCode() let parseAndCheckFile = - cancellableTask { + async2 { let! (parseResults, checkFileAnswer) = checker.ParseAndCheckFileInProject( filePath, @@ -454,16 +453,16 @@ module private CheckerExtensions = } let tryGetFreshResultsWithTimeout () = - cancellableTask { + async2 { let! worker = - Async.StartChild( - async { + Async2.StartChild( + async2 { try return! parseAndCheckFile with _ -> return None - }, - millisecondsTimeout = document.Project.FSharpTimeUntilStaleCompletion + } //, + //millisecondsTimeout = document.Project.FSharpTimeUntilStaleCompletion ) try @@ -477,9 +476,9 @@ module private CheckerExtensions = let! results = match freshResults with - | Some x -> CancellableTask.singleton (Some x) + | Some x -> Async2.fromValue (Some x) | None -> - cancellableTask { + async2 { match checker.TryGetRecentCheckResultsForFile(filePath, options, userOpName = userOpName) with | Some(parseResults, checkFileResults, _) -> return Some(parseResults, checkFileResults) | None -> return! parseAndCheckFile @@ -494,7 +493,7 @@ module private CheckerExtensions = member checker.ParseAndCheckDocument (document: Document, options: FSharpProjectOptions, userOpName: string, ?allowStaleResults: bool) = - cancellableTask { + async2 { if checker.UsesTransparentCompiler then return! checker.ParseAndCheckDocumentUsingTransparentCompiler(document, options, userOpName) @@ -516,12 +515,12 @@ type Document with raise (OperationCanceledException("Document is not a FSharp document.")) else match ProjectCache.Projects.TryGetValue(this.Project) with - | true, result -> CancellableTask.singleton result + | true, result -> Async2.fromValue result | _ -> - cancellableTask { + async2 { let service = this.Project.Solution.GetFSharpWorkspaceService() let projectOptionsManager = service.FSharpProjectOptionsManager - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken match! projectOptionsManager.TryGetOptionsForDocumentOrProject(this, ct, userOpName) with | ValueNone -> return raise (OperationCanceledException("FSharp project options not found.")) @@ -534,7 +533,7 @@ type Document with /// Get the compilation defines and language version from F# project that is associated with the given F# document. member this.GetFsharpParsingOptionsAsync(userOpName) = - async { + async2 { let! _, _, parsingOptions, _ = this.GetFSharpCompilationOptionsAsync(userOpName) return @@ -573,7 +572,7 @@ type Document with /// Parses the given F# document. member this.GetFSharpParseResultsAsync(userOpName) = - cancellableTask { + async2 { let! checker, _, parsingOptions, options = this.GetFSharpCompilationOptionsAsync(userOpName) if this.Project.UseTransparentCompiler then @@ -584,7 +583,7 @@ type Document with /// Parses and checks the given F# document. member this.GetFSharpParseAndCheckResultsAsync(userOpName) = - cancellableTask { + async2 { let! checker, _, _, projectOptions = this.GetFSharpCompilationOptionsAsync(userOpName) match! checker.ParseAndCheckDocument(this, projectOptions, userOpName, allowStaleResults = false) with @@ -594,17 +593,17 @@ type Document with /// Get the semantic classifications of the given F# document. member this.GetFSharpSemanticClassificationAsync(userOpName) = - cancellableTask { + async2 { let! checker, _, _, projectOptions = this.GetFSharpCompilationOptionsAsync(userOpName) let! result = - if this.Project.UseTransparentCompiler then - async { - let! projectSnapshot = getProjectSnapshotForDocument (this, projectOptions) - return! checker.GetBackgroundSemanticClassificationForFile(this.FilePath, projectSnapshot) - } - else - checker.GetBackgroundSemanticClassificationForFile(this.FilePath, projectOptions) + async2 { + if this.Project.UseTransparentCompiler then + let! projectSnapshot = getProjectSnapshotForDocument (this, projectOptions) + return! checker.GetBackgroundSemanticClassificationForFile(this.FilePath, projectSnapshot) + else + return! checker.GetBackgroundSemanticClassificationForFile(this.FilePath, projectOptions) + } return result @@ -613,7 +612,7 @@ type Document with /// Find F# references in the given F# document. member inline this.FindFSharpReferencesAsync(symbol, projectSnapshot: FSharpProjectSnapshot, [] onFound, userOpName) = - cancellableTask { + async2 { let! checker, _, _, projectOptions = this.GetFSharpCompilationOptionsAsync(userOpName) let! symbolUses = @@ -632,15 +631,15 @@ type Document with do! symbolUses |> Seq.map onFound - |> CancellableTask.whenAll - |> CancellableTask.ignore + |> Async2.Parallel + |> Async2.Ignore } /// Try to find a F# lexer/token symbol of the given F# document and position. member this.TryFindFSharpLexerSymbolAsync(position, lookupKind, wholeActivePattern, allowStringToken, userOpName) = - cancellableTask { + async2 { let! defines, langVersion, strictIndentation = this.GetFsharpParsingOptionsAsync(userOpName) - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! sourceText = this.GetTextAsync(ct) return @@ -663,7 +662,7 @@ type Project with /// Find F# references in the given project. member this.FindFSharpReferencesAsync(symbol: FSharpSymbol, projectSnapshot, onFound, userOpName) = - cancellableTask { + async2 { let declarationLocation = symbol.SignatureLocation @@ -677,7 +676,7 @@ type Project with let! canSkipDocuments = match declarationDocument with | Some document when this.IsFastFindReferencesEnabled && document.Project = this -> - cancellableTask { + async2 { let! _, _, _, options = document.GetFSharpCompilationOptionsAsync(userOpName) let signatureFile = @@ -693,7 +692,7 @@ type Project with |> Seq.filter ((<>) signatureFile) |> Set } - | _ -> CancellableTask.singleton Set.empty + | _ -> Async2.fromValue Set.empty let documents = this.Documents @@ -705,7 +704,8 @@ type Project with documents |> Seq.map (fun doc -> doc.FindFSharpReferencesAsync(symbol, projectSnapshot, (fun range -> onFound doc range), userOpName)) - |> CancellableTask.whenAll + |> Async2.Parallel + |> Async2.Ignore else for doc in documents do do! doc.FindFSharpReferencesAsync(symbol, projectSnapshot, (onFound doc), userOpName) @@ -714,4 +714,4 @@ type Project with member this.GetFSharpCompilationOptionsAsync() = this |> getFSharpOptionsForProject member this.GetFSharpProjectSnapshot(?snapshotAccumulator) = - cancellableTask { return! getOrCreateSnapshotForProject this None snapshotAccumulator } + async2 { return! getOrCreateSnapshotForProject this None snapshotAccumulator } diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindDefinitionService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindDefinitionService.fs index bc408c01741..1f99f779247 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindDefinitionService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindDefinitionService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -10,15 +10,15 @@ open FSharp.Compiler.Text.Range open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.ExternalAccess.FSharp.GoToDefinition -open CancellableTasks +open Internal.Utilities.Library [)>] [)>] type internal FSharpFindDefinitionService [] (metadataAsSource: FSharpMetadataAsSourceService) = interface IFSharpFindDefinitionService with member _.FindDefinitionsAsync(document: Document, position: int, cancellationToken: CancellationToken) = - cancellableTask { + async2 { let navigation = FSharpNavigation(metadataAsSource, document, rangeStartup) return! navigation.FindDefinitionsAsync(position) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs index c313d4f27ee..7afc7726961 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs @@ -13,7 +13,7 @@ open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FindUsages open FSharp.Compiler.EditorServices open FSharp.Compiler.Text -open CancellableTasks +open Internal.Utilities.Library module FSharpFindUsagesService = @@ -28,8 +28,8 @@ module FSharpFindUsagesService = (doc: Document) (symbolUse: range) = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! sourceText = doc.GetTextAsync(cancellationToken) match declarationRange, RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse) with @@ -61,17 +61,17 @@ module FSharpFindUsagesService = // File can be included in more than one project, hence single `range` may results with multiple `Document`s. let rangeToDocumentSpans (solution: Solution, range: range, symbolName: string) = if range.Start = range.End then - CancellableTask.singleton [||] + Async2.fromValue [||] else - cancellableTask { + async2 { let documentIds = solution.GetDocumentIdsWithFilePath(range.FileName) let! spans = seq { for documentId in documentIds do - cancellableTask { + async2 { let doc = solution.GetDocument(documentId) - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! sourceText = doc.GetTextAsync(cancellationToken) match Tokenizer.TryFSharpRangeToTextSpanForEditor(sourceText, range, symbolName) with @@ -79,16 +79,16 @@ module FSharpFindUsagesService = | ValueNone -> return None } } - |> CancellableTask.whenAll + |> Async2.whenAll return spans |> Array.choose id } let findReferencedSymbolsAsync (document: Document, position: int, context: IFSharpFindUsagesContext, allReferences: bool, userOp: string) - : CancellableTask = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + : Async2 = + async2 { + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) let textLine = sourceText.Lines.GetLineFromPosition(position).ToString() let lineNumber = sourceText.Lines.GetLinePosition(position).Line + 1 @@ -120,7 +120,7 @@ module FSharpFindUsagesService = let! declarationSpans = match declarationRange with | Some range -> rangeToDocumentSpans (document.Project.Solution, range, symbol.Ident.idText) - | None -> CancellableTask.singleton [||] + | None -> Async2.fromValue [||] let declarationSpans = declarationSpans @@ -169,8 +169,8 @@ type internal FSharpFindUsagesService [] () = interface IFSharpFindUsagesService with member _.FindReferencesAsync(document, position, context) = findReferencedSymbolsAsync (document, position, context, true, nameof (FSharpFindUsagesService)) - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken member _.FindImplementationsAsync(document, position, context) = findReferencedSymbolsAsync (document, position, context, false, nameof (FSharpFindUsagesService)) - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs index 99b3ff241ad..ca7f3d2fbf9 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -26,7 +26,7 @@ open FSharp.Compiler.Text.Range open FSharp.Compiler.Symbols open System.Composition open System.Text.RegularExpressions -open CancellableTasks +open Internal.Utilities.Library open Microsoft.VisualStudio.FSharp.Editor.Telemetry open Microsoft.VisualStudio.Telemetry open Microsoft.VisualStudio.Threading @@ -177,7 +177,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = /// Use an origin document to provide the solution & workspace used to /// find the corresponding textSpan and INavigableItem for the range let rangeToNavigableItem (range: range, document: Document) = - cancellableTask { + async2 { let fileName = try System.IO.Path.GetFullPath range.FileName @@ -189,8 +189,8 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = if not refDocumentIds.IsEmpty then let refDocumentId = refDocumentIds.First() let refDocument = document.Project.Solution.GetDocument refDocumentId - let! cancellationToken = Async.CancellationToken - let! refSourceText = refDocument.GetTextAsync(cancellationToken) |> Async.AwaitTask + let! cancellationToken = Async2.CancellationToken + let! refSourceText = refDocument.GetTextAsync(cancellationToken) match RoslynHelpers.TryFSharpRangeToTextSpan(refSourceText, range) with | ValueNone -> return None @@ -222,10 +222,10 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = | _ -> None match textOpt with - | None -> CancellableTask.singleton None + | None -> Async2.fromValue None | Some(text, fileName) -> - foregroundCancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken do! ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken) let tmpProjInfo, tmpDocInfo = @@ -254,8 +254,8 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = |> ValueOption.map (fun x -> x.Range) let! span = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken match r with | ValueNone -> return TextSpan.empty @@ -275,9 +275,9 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = let originTextSpan = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, originRange) match originTextSpan with - | ValueNone -> CancellableTask.singleton None + | ValueNone -> Async2.fromValue None | ValueSome originTextSpan -> - cancellableTask { + async2 { let userOpName = "FindSymbolHelper" let position = originTextSpan.Start @@ -291,7 +291,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = let lineText = (sourceText.Lines.GetLineFromPosition position).ToString() let idRange = lexerSymbol.Ident.idRange - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! _, checkFileResults = originDocument.GetFSharpParseAndCheckResultsAsync(nameof (GoToDefinition)) @@ -351,15 +351,12 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = member _.FindSymbolDeclarationInDocument(targetSymbolUse: FSharpSymbolUse, document: Document) = asyncMaybe { let filePath = document.FilePath - let! ct = Async.CancellationToken |> liftAsync match targetSymbolUse.Symbol.DeclarationLocation with | Some decl when decl.FileName = filePath -> return decl | _ -> let! _, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("FindSymbolDeclarationInDocument") - |> CancellableTask.start ct - |> Async.AwaitTask |> liftAsync let symbolUses = checkFileResults.GetUsesOfSymbolInFile targetSymbolUse.Symbol @@ -373,9 +370,9 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = } member internal this.FindDefinitionAtPosition(originDocument: Document, position: int) = - cancellableTask { + async2 { let userOpName = "FindDefinitionAtPosition" - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! sourceText = originDocument.GetTextAsync(cancellationToken) let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position @@ -383,7 +380,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = let fcsTextLineNumber = Line.fromZ textLinePos.Line let lineText = (sourceText.Lines.GetLineFromPosition position).ToString() - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let preferSignature = isSignatureFile originDocument.FilePath @@ -614,31 +611,31 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = /// Find the declaration location (signature file/.fsi) of the target symbol if possible, fall back to definition member this.NavigateToSymbolDeclarationAsync(targetDocument: Document, targetSourceText: SourceText, symbolRange: range) = - cancellableTask { + async2 { let! item = this.FindDeclarationOfSymbolAtRange(targetDocument, symbolRange, targetSourceText) match item with | None -> return false | Some item -> - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken return this.NavigateToItem(item, cancellationToken) } /// Find the definition location (implementation file/.fs) of the target symbol member this.NavigateToSymbolDefinitionAsync(targetDocument: Document, targetSourceText: SourceText, symbolRange: range) = - cancellableTask { + async2 { let! item = this.FindDefinitionOfSymbolAtRange(targetDocument, symbolRange, targetSourceText) match item with | None -> return false | Some item -> - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken return this.NavigateToItem(item, cancellationToken) } member this.NavigateToExternalDeclarationAsync(targetSymbolUse: FSharpSymbolUse, metadataReferences: seq) = - foregroundCancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken match! this.TryGetExternalDeclarationAsync(targetSymbolUse, metadataReferences) with | Some navItem -> return this.NavigateToItem(navItem, cancellationToken) @@ -684,9 +681,9 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = match tmpShownDocOpt with | ValueSome tmpShownDoc -> let goToAsync = - cancellableTask { + async2 { - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! _, checkResults = tmpShownDoc.GetFSharpParseAndCheckResultsAsync("NavigateToExternalDeclaration") @@ -712,7 +709,7 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = } - let span = CancellableTask.runSynchronously cancellationToken goToAsync + let span = Async2.run cancellationToken goToAsync let navItem = FSharpGoToDefinitionNavigableItem(tmpShownDoc, span) this.NavigateToItem(navItem, cancellationToken) @@ -735,14 +732,14 @@ type internal FSharpNavigation(metadataAsSource: FSharpMetadataAsSourceService, ThreadHelper.JoinableTaskFactory.Run( SR.NavigatingTo(), (fun _progress cancellationToken -> - cancellableTask { + async2 { let targetDoc = solution.TryGetDocumentFromFSharpRange(range, initialDoc.Project.Id) match targetDoc with | None -> () | Some targetDoc -> - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! targetSource = targetDoc.GetTextAsync(cancellationToken) let targetTextSpan = RoslynHelpers.TryFSharpRangeToTextSpan(targetSource, range) @@ -768,7 +765,7 @@ type internal FSharpNavigation(metadataAsSource: FSharpMetadataAsSourceService, // In case the above fails, we just navigate to target range. do gtd.TryNavigateToTextSpan(targetDoc, targetTextSpan, cancellationToken) } - |> CancellableTask.start cancellationToken), + |> Async2.startInThreadPool cancellationToken), // Default wait time before VS shows the dialog allowing to cancel the long running task is 2 seconds. // This seems a bit too long to leave the user without any feedback, so we shorten it to 1 second. // Note: it seems anything less than 1 second will get rounded down to zero, resulting in flashing dialog @@ -779,7 +776,7 @@ type internal FSharpNavigation(metadataAsSource: FSharpMetadataAsSourceService, () member _.FindDefinitionsAsync(position) = - cancellableTask { + async2 { let gtd = GoToDefinition(metadataAsSource) let! result = gtd.FindDefinitionAtPosition(initialDoc, position) @@ -801,7 +798,7 @@ type internal FSharpNavigation(metadataAsSource: FSharpMetadataAsSourceService, TelemetryReporter.ReportSingleEventWithDuration(TelemetryEvents.GoToDefinition, [||]) let gtd = GoToDefinition(metadataAsSource) - let gtdTask = gtd.FindDefinitionAsync (initialDoc, position) cancellationToken + let gtdTask = gtd.FindDefinitionAsync(initialDoc, position) |> Async2.startInThreadPool cancellationToken gtdTask.Wait() @@ -855,10 +852,10 @@ type internal DocCommentId = type FSharpNavigableLocation(metadataAsSource: FSharpMetadataAsSourceService, symbolRange: range, project: Project) = interface IFSharpNavigableLocation with member _.NavigateToAsync(_options: FSharpNavigationOptions2, cancellationToken: CancellationToken) : Task = - cancellableTask { + async2 { let targetPath = symbolRange.FileName - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let targetDoc = project.Solution.TryGetDocumentFromFSharpRange(symbolRange, project.Id) @@ -879,7 +876,7 @@ type FSharpNavigableLocation(metadataAsSource: FSharpMetadataAsSourceService, sy | Signature -> return! gtd.NavigateToSymbolDefinitionAsync(targetDoc, targetSource, symbolRange) | Implementation -> return! gtd.NavigateToSymbolDeclarationAsync(targetDoc, targetSource, symbolRange) } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken [)>] [)>] @@ -1061,7 +1058,7 @@ type FSharpCrossLanguageSymbolNavigationService() = let path = FSharpCrossLanguageSymbolNavigationService.DocCommentIdToPath documentationCommentId - cancellableTask { + async2 { let projects = workspace.CurrentSolution.Projects |> Seq.filter (fun p -> p.IsFSharp && p.AssemblyName = assemblyName) @@ -1117,4 +1114,4 @@ type FSharpCrossLanguageSymbolNavigationService() = else return Unchecked.defaultof<_> // returning null here, so Roslyn can fallback to default source-as-metadata implementation. } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs index 76233f6fe7e..7c7e2b7e4f3 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinitionService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -9,7 +9,7 @@ open FSharp.Compiler.Text.Range open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor -open CancellableTasks +open Internal.Utilities.Library open System.Collections.Generic [)>] @@ -19,12 +19,12 @@ type internal FSharpGoToDefinitionService [] (metadataAsSo interface IFSharpGoToDefinitionService with /// Invoked with Peek Definition. member _.FindDefinitionsAsync(document: Document, position: int, _cancellationToken: CancellationToken) = - cancellableTask { + async2 { let navigation = FSharpNavigation(metadataAsSource, document, rangeStartup) let! res = navigation.FindDefinitionsAsync(position) return (res :> IEnumerable<_>) } - |> CancellableTask.startWithoutCancellation + |> Async2.startAsTaskWithoutCancellation /// Invoked with Go to Definition. /// Try to navigate to the definition of the symbol at the symbolRange in the originDocument diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs index ac954d2d278..1b1dc71994e 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigableSymbolsService.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -16,8 +16,7 @@ open Microsoft.VisualStudio.Text.Editor open Microsoft.VisualStudio.Utilities open Microsoft.VisualStudio.FSharp.Editor.Telemetry open Microsoft.VisualStudio.Telemetry -open CancellableTasks.CancellableTaskBuilder -open CancellableTasks +open Internal.Utilities.Library [] type internal FSharpNavigableSymbol(item: FSharpNavigableItem, span: SnapshotSpan, gtd: GoToDefinition) = @@ -40,14 +39,14 @@ type internal FSharpNavigableSymbolSource(metadataAsSource) = if disposed then null else - cancellableTask { + async2 { use _ = TelemetryReporter.ReportSingleEventWithDuration(TelemetryEvents.GoToDefinitionGetSymbol, [||]) let snapshot = triggerSpan.Snapshot let position = triggerSpan.Start.Position let document = snapshot.GetOpenDocumentInCurrentContextWithChanges() - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) try @@ -91,7 +90,7 @@ type internal FSharpNavigableSymbolSource(metadataAsSource) = // The NavigableSymbols API accepts 'null' when there's nothing to navigate to. return null } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken member _.Dispose() = disposed <- true diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs index 546b00e1b16..8cf0d7f7463 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs @@ -17,7 +17,7 @@ open Microsoft.VisualStudio.LanguageServices open Microsoft.VisualStudio.Text.PatternMatching open FSharp.Compiler.EditorServices -open CancellableTasks +open Internal.Utilities.Library [); Shared>] type internal FSharpNavigateToSearchService @@ -34,8 +34,8 @@ type internal FSharpNavigateToSearchService cache.Clear() let getNavigableItems (document: Document) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! currentVersion = document.GetTextVersionAsync(ct) match cache.TryGetValue document.Id with @@ -144,8 +144,8 @@ type internal FSharpNavigateToSearchService |> ValueOption.ofNullable let processDocument (tryMatch: NavigableItem -> PatternMatch voption) (kinds: IImmutableSet) (document: Document) = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + async2 { + let! ct = Async2.CancellationToken let! sourceText = document.GetTextAsync ct @@ -191,7 +191,7 @@ type internal FSharpNavigateToSearchService member _.SearchProjectAsync (project, _priorityDocuments, searchPattern, kinds, cancellationToken) : Task> = - cancellableTask { + async2 { let tryMatch = createMatcherFor searchPattern let tasks = @@ -200,7 +200,7 @@ type internal FSharpNavigateToSearchService yield processDocument tryMatch kinds doc |] - let! results = CancellableTask.whenAll tasks + let! results = Async2.whenAll tasks let results' = ImmutableArray.CreateBuilder() @@ -211,14 +211,14 @@ type internal FSharpNavigateToSearchService return results'.ToImmutable() } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken member _.SearchDocumentAsync(document: Document, searchPattern, kinds, cancellationToken) = - cancellableTask { + async2 { let! result = processDocument (createMatcherFor searchPattern) kinds document return Array.toImmutableArray result } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken member _.KindsProvided = kindsProvided diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs index b31b42c9822..a48baaa599e 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigationBarItemService.fs @@ -9,7 +9,7 @@ open System.Threading.Tasks open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor open FSharp.Compiler.EditorServices -open CancellableTasks +open Internal.Utilities.Library type internal NavigationBarSymbolItem(text, glyph, spans, childItems) = inherit FSharpNavigationBarItem(text, glyph, spans, childItems) @@ -21,9 +21,9 @@ type internal FSharpNavigationBarItemService [] () = interface IFSharpNavigationBarItemService with member _.GetItemsAsync(document, cancellationToken) : Task> = - cancellableTask { + async2 { - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! parseResults = document.GetFSharpParseResultsAsync(nameof (FSharpNavigationBarItemService)) @@ -59,4 +59,4 @@ type internal FSharpNavigationBarItemService [] () = :> FSharpNavigationBarItem)) :> IList<_> } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index c9179889f49..32267f0efe0 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor.QuickInfo @@ -18,13 +18,13 @@ open Microsoft.VisualStudio.FSharp.Editor open FSharp.Compiler.Text open Microsoft.IO open FSharp.Compiler.EditorServices -open CancellableTasks +open Internal.Utilities.Library type internal FSharpAsyncQuickInfoSource (xmlMemberIndexService, metadataAsSource: FSharpMetadataAsSourceService, textBuffer: ITextBuffer, editorOptions: EditorOptions) = let getQuickInfoItem (sourceText, (document: Document), (lexerSymbol: LexerSymbol), (ToolTipText elements)) = - cancellableTask { + async2 { let documentationBuilder = XmlDocumentation.CreateDocumentationBuilder(xmlMemberIndexService) @@ -74,9 +74,9 @@ type internal FSharpAsyncQuickInfoSource } static member TryGetToolTip(document: Document, position, ?width) = - cancellableTask { + async2 { let userOpName = "getQuickInfo" - let! cancellationToken = CancellableTask.getCancellationToken () + let! cancellationToken = Async2.CancellationToken let! lexerSymbol = document.TryFindFSharpLexerSymbolAsync(position, SymbolLookupKind.Greedy, true, true, userOpName) match lexerSymbol with @@ -118,7 +118,7 @@ type internal FSharpAsyncQuickInfoSource override _.Dispose() = () // no cleanup necessary override _.GetQuickInfoItemAsync(session: IAsyncQuickInfoSession, cancellationToken: CancellationToken) : Task = - cancellableTask { + async2 { let document = textBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges() @@ -139,7 +139,7 @@ type internal FSharpAsyncQuickInfoSource | None -> return Unchecked.defaultof<_> } - |> CancellableTask.start cancellationToken + |> Async2.startInThreadPool cancellationToken [)>] [] diff --git a/vsintegration/src/FSharp.Editor/Refactor/AddExplicitTypeToParameter.fs b/vsintegration/src/FSharp.Editor/Refactor/AddExplicitTypeToParameter.fs index bcea39dd8ec..0bb53ecd8d0 100644 --- a/vsintegration/src/FSharp.Editor/Refactor/AddExplicitTypeToParameter.fs +++ b/vsintegration/src/FSharp.Editor/Refactor/AddExplicitTypeToParameter.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -14,7 +14,7 @@ open FSharp.Compiler.Syntax open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeRefactorings open Microsoft.CodeAnalysis.CodeActions -open CancellableTasks +open Internal.Utilities.Library [] type internal FSharpAddExplicitTypeToParameterRefactoring [] () = @@ -24,13 +24,11 @@ type internal FSharpAddExplicitTypeToParameterRefactoring [ liftTaskAsync + let! sourceText = document.GetTextAsync(context.CancellationToken) let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position let fcsTextLineNumber = Line.fromZ textLinePos.Line - let! ct = Async.CancellationToken |> liftAsync - let! lexerSymbol = document.TryFindFSharpLexerSymbolAsync( position, @@ -39,13 +37,9 @@ type internal FSharpAddExplicitTypeToParameterRefactoring [ CancellableTask.start ct - |> Async.AwaitTask let! parseFileResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync(nameof (FSharpAddExplicitTypeToParameterRefactoring)) - |> CancellableTask.start ct - |> Async.AwaitTask |> liftAsync let! symbolUse = @@ -105,16 +99,16 @@ type internal FSharpAddExplicitTypeToParameterRefactoring [ - async { - let! sourceText = context.Document.GetTextAsync(cancellationToken) |> Async.AwaitTask + async2 { + let! sourceText = context.Document.GetTextAsync(cancellationToken) return context.Document.WithText(getChangedText sourceText) } - |> RoslynHelpers.StartAsyncAsTask(cancellationToken)), + |> Async2.startAsTask cancellationToken), title ) context.RegisterRefactoring(codeAction) | _ -> () } - |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) + |> Async2.Ignore + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Refactor/AddReturnType.fs b/vsintegration/src/FSharp.Editor/Refactor/AddReturnType.fs index e18eb2b33be..89c5c8ef9e2 100644 --- a/vsintegration/src/FSharp.Editor/Refactor/AddReturnType.fs +++ b/vsintegration/src/FSharp.Editor/Refactor/AddReturnType.fs @@ -1,6 +1,8 @@ -namespace Microsoft.VisualStudio.FSharp.Editor +namespace Microsoft.VisualStudio.FSharp.Editor open System.Composition +open System.Threading + open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Symbols open FSharp.Compiler.Text @@ -8,7 +10,7 @@ open FSharp.Compiler.Text open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeRefactorings open Microsoft.CodeAnalysis.CodeActions -open CancellableTasks +open Internal.Utilities.Library [] type internal AddReturnType [] () = @@ -55,17 +57,17 @@ type internal AddReturnType [] () = let textChange = TextChange(textSpan, $": {inferredType} ") sourceText.WithChanges(textChange) - let codeActionFunc = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () - let! sourceText = context.Document.GetTextAsync(cancellationToken) - let changedText = getChangedText sourceText - - let newDocument = context.Document.WithText(changedText) - return newDocument - } - - let codeAction = CodeAction.Create(title, codeActionFunc, title) + let codeAction = + CodeAction.Create( + title, + (fun (cancellationToken: CancellationToken) -> + async2 { + let! sourceText = context.Document.GetTextAsync(cancellationToken) + return context.Document.WithText(getChangedText sourceText) + } + |> Async2.startAsTask cancellationToken), + title + ) do context.RegisterRefactoring(codeAction) @@ -75,7 +77,7 @@ type internal AddReturnType [] () = | _ -> None override _.ComputeRefactoringsAsync context = - cancellableTask { + async2 { try let document = context.Document let position = context.Span.Start @@ -121,4 +123,4 @@ type internal AddReturnType [] () = // Just return without offering any refactorings. return () } - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Refactor/ChangeDerefToValueRefactoring.fs b/vsintegration/src/FSharp.Editor/Refactor/ChangeDerefToValueRefactoring.fs index 07408c049b1..9874e49af5b 100644 --- a/vsintegration/src/FSharp.Editor/Refactor/ChangeDerefToValueRefactoring.fs +++ b/vsintegration/src/FSharp.Editor/Refactor/ChangeDerefToValueRefactoring.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -15,7 +15,7 @@ open FSharp.Compiler.Syntax open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeRefactorings open Microsoft.CodeAnalysis.CodeActions -open CancellableTasks +open Internal.Utilities.Library [] type internal FSharpChangeDerefToValueRefactoring [] () = @@ -28,8 +28,6 @@ type internal FSharpChangeDerefToValueRefactoring [] () = let! parseResults = document.GetFSharpParseResultsAsync(nameof (FSharpChangeDerefToValueRefactoring)) - |> CancellableTask.start context.CancellationToken - |> Async.AwaitTask |> liftAsync let selectionRange = @@ -54,15 +52,15 @@ type internal FSharpChangeDerefToValueRefactoring [] () = CodeAction.Create( title, (fun (cancellationToken: CancellationToken) -> - async { - let! sourceText = context.Document.GetTextAsync(cancellationToken) |> Async.AwaitTask + async2 { + let! sourceText = context.Document.GetTextAsync(cancellationToken) return context.Document.WithText(getChangedText sourceText) } - |> RoslynHelpers.StartAsyncAsTask(cancellationToken)), + |> Async2.startAsTask cancellationToken), title ) context.RegisterRefactoring(codeAction) } - |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) + |> Async2.Ignore + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Refactor/ChangeTypeofWithNameToNameofExpression.fs b/vsintegration/src/FSharp.Editor/Refactor/ChangeTypeofWithNameToNameofExpression.fs index 6cc93b06d87..ebd807bb884 100644 --- a/vsintegration/src/FSharp.Editor/Refactor/ChangeTypeofWithNameToNameofExpression.fs +++ b/vsintegration/src/FSharp.Editor/Refactor/ChangeTypeofWithNameToNameofExpression.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Microsoft.VisualStudio.FSharp.Editor @@ -15,7 +15,7 @@ open FSharp.Compiler.Syntax open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeRefactorings open Microsoft.CodeAnalysis.CodeActions -open CancellableTasks +open Internal.Utilities.Library [] type internal FSharpChangeTypeofWithNameToNameofExpressionRefactoring [] () = @@ -28,8 +28,6 @@ type internal FSharpChangeTypeofWithNameToNameofExpressionRefactoring [ CancellableTask.start context.CancellationToken - |> Async.AwaitTask |> liftAsync let selectionRange = @@ -51,15 +49,15 @@ type internal FSharpChangeTypeofWithNameToNameofExpressionRefactoring [ - async { - let! sourceText = context.Document.GetTextAsync(cancellationToken) |> Async.AwaitTask + async2 { + let! sourceText = context.Document.GetTextAsync(cancellationToken) return context.Document.WithText(getChangedText sourceText) } - |> RoslynHelpers.StartAsyncAsTask(cancellationToken)), + |> Async2.startAsTask cancellationToken), title ) context.RegisterRefactoring(codeAction) } - |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) + |> Async2.Ignore + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs index d0326d84311..35600309a5c 100644 --- a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs +++ b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs @@ -151,18 +151,18 @@ module internal BlockStructure = | _, _ -> ValueNone) open BlockStructure -open CancellableTasks +open Internal.Utilities.Library [)>] type internal FSharpBlockStructureService [] () = - let emptyValue = FSharpBlockStructure ImmutableArray.empty + //let emptyValue = FSharpBlockStructure ImmutableArray.empty interface IFSharpBlockStructureService with member _.GetBlockStructureAsync(document, cancellationToken) : Task = - cancellableTask { - let! cancellationToken = CancellableTask.getCancellationToken () + async2 { + let! cancellationToken = Async2.CancellationToken let! sourceText = document.GetTextAsync(cancellationToken) @@ -173,5 +173,5 @@ type internal FSharpBlockStructureService [] () = |> Seq.toImmutableArray |> FSharpBlockStructure } - |> CancellableTask.ifCanceledReturn emptyValue - |> CancellableTask.start cancellationToken + //|> CancellableTask.ifCanceledReturn emptyValue + |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs b/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs index a82e414e754..cb2bca940d3 100644 --- a/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs +++ b/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs @@ -1,4 +1,4 @@ -// Microsoft.CodeAnalysis.ExternalAccess.FSharp.TaskList.FSharpTaskListService +// Microsoft.CodeAnalysis.ExternalAccess.FSharp.TaskList.FSharpTaskListService namespace Microsoft.VisualStudio.FSharp.Editor @@ -13,27 +13,21 @@ open FSharp.Compiler open System.Collections.Immutable open System.Diagnostics -open CancellableTasks +open Internal.Utilities.Library [)>] type internal FSharpTaskListService [] () as this = let getDefinesAndLangVersion (doc: Microsoft.CodeAnalysis.Document) = - asyncMaybe { - let! ct = Async.CancellationToken |> liftAsync - + async2 { let! _, _, parsingOptions, _ = doc.GetFSharpCompilationOptionsAsync(nameof (FSharpTaskListService)) - |> CancellableTask.start ct - |> Async.AwaitTask - |> liftAsync return CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions, Some parsingOptions.LangVersionText, parsingOptions.StrictIndentation } - |> Async.map (Option.defaultValue ([], None, None)) let extractContractedComments (tokens: Tokenizer.SavedTokenInfo[]) = let granularTokens = @@ -117,9 +111,10 @@ type internal FSharpTaskListService [] () as this = interface IFSharpTaskListService with member _.GetTaskListItemsAsync(doc, desc, cancellationToken) = - backgroundTask { + async2 { let descriptors = desc |> Seq.map (fun d -> d.Text, d) |> Array.ofSeq let! sourceText = doc.GetTextAsync(cancellationToken) let! defines, langVersion, strictIndentation = doc |> getDefinesAndLangVersion return this.GetTaskListItems(doc, sourceText, defines, langVersion, strictIndentation, descriptors, cancellationToken) } + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs index 8027a06e85f..730f7eeed8c 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/BraceMatchingServiceTests.fs @@ -9,6 +9,7 @@ open FSharp.Compiler.CodeAnalysis open Microsoft.VisualStudio.FSharp.Editor open FSharp.Editor.Tests.Helpers open FSharp.Test +open Internal.Utilities.Library type BraceMatchingServiceTests() = let checker = @@ -31,7 +32,7 @@ type BraceMatchingServiceTests() = match FSharpBraceMatchingService.GetBraceMatchingResult(checker, sourceText, fileName, parsingOptions, position, "UnitTest") - |> Async.RunImmediateExceptOnUI + |> Async2.RunSynchronously with | None -> () | Some _ -> failwith $"Found match for brace '{marker}'" @@ -61,7 +62,7 @@ type BraceMatchingServiceTests() = startMarkerPosition, "UnitTest" ) - |> Async.RunImmediateExceptOnUI + |> Async2.RunSynchronously with | None -> failwith $"Didn't find a match for start brace at position '{startMarkerPosition}" | Some(left, right) -> @@ -281,7 +282,7 @@ let main argv = for position in matchingPositions do match FSharpBraceMatchingService.GetBraceMatchingResult(checker, sourceText, fileName, parsingOptions, position, "UnitTest") - |> Async.RunSynchronously + |> Async2.RunSynchronously with | Some _ -> () | None -> diff --git a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs index de8b3c28ccd..54d5ae43feb 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs @@ -8,6 +8,7 @@ open Xunit open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor open FSharp.Editor.Tests.Helpers +open Internal.Utilities.Library type BreakpointResolutionServiceTests() = @@ -60,10 +61,8 @@ let main argv = TextSpan.FromBounds(searchPosition, searchPosition + searchToken.Length) let actualResolutionOption = - let task = - FSharpBreakpointResolutionService.GetBreakpointLocation (document, searchSpan) CancellationToken.None - - task.Result + FSharpBreakpointResolutionService.GetBreakpointLocation(document, searchSpan) + |> Async2.RunSynchronously match actualResolutionOption with | ValueNone -> Assert.True(expectedResolution.IsNone, "BreakpointResolutionService failed to resolve breakpoint position") diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs index d5f2dbd3988..94615be785e 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs @@ -10,7 +10,7 @@ open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library open FSharp.Compiler.Diagnostics open FSharp.Editor.Tests.Helpers @@ -58,7 +58,7 @@ module FSharpDiagnostics = let generate mode (document: Document) = match mode with | Manual(squiggly, diagnostic) -> - cancellableTask { + async2 { let! sourceText = document.GetTextAsync() let spanStart = sourceText.ToString().IndexOf squiggly let span = TextSpan(spanStart, squiggly.Length) @@ -82,7 +82,7 @@ module FSharpDiagnostics = | WithSignature _ | WithSettings _ -> document.GetFSharpParseAndCheckResultsAsync "test" - |> CancellableTask.map (fun (_, checkResults) -> checkResults.Diagnostics) + |> Async2.map (fun (_, checkResults) -> checkResults.Diagnostics) module CodeFixContext = let private registerCodeFix = @@ -108,7 +108,7 @@ type CodeFixProvider with this.FixableDiagnosticIds.Contains diagnostic.Id let tryFix (code: string) mode (fixProvider: 'T when 'T :> IFSharpCodeFixProvider and 'T :> CodeFixProvider) = - cancellableTask { + async2 { let document = Document.create mode code let sourceText = SourceText.From code let! fsharpDiagnostics = FSharpDiagnostics.generate mode document @@ -126,13 +126,13 @@ let tryFix (code: string) mode (fixProvider: 'T when 'T :> IFSharpCodeFixProvide return! context - |> ValueOption.either fixProvider.GetCodeFixIfAppliesAsync (CancellableTask.singleton ValueNone) - |> CancellableTask.map (ValueOption.map (TestCodeFix.ofFSharpCodeFix sourceText) >> ValueOption.toOption) + |> ValueOption.either fixProvider.GetCodeFixIfAppliesAsync (Async2.fromValue ValueNone) + |> Async2.map (ValueOption.map (TestCodeFix.ofFSharpCodeFix sourceText) >> ValueOption.toOption) } - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously let multiFix (code: string) mode (fixProvider: 'T when 'T :> IFSharpMultiCodeFixProvider and 'T :> CodeFixProvider) = - cancellableTask { + async2 { let document = Document.create mode code let sourceText = SourceText.From code let! fsharpDiagnostics = FSharpDiagnostics.generate mode document @@ -150,10 +150,10 @@ let multiFix (code: string) mode (fixProvider: 'T when 'T :> IFSharpMultiCodeFix return! context - |> ValueOption.either fixProvider.GetCodeFixesAsync (CancellableTask.singleton Seq.empty) - |> CancellableTask.map (Seq.map (TestCodeFix.ofFSharpCodeFix sourceText)) + |> ValueOption.either fixProvider.GetCodeFixesAsync (Async2.fromValue Seq.empty) + |> Async2.map (Seq.map (TestCodeFix.ofFSharpCodeFix sourceText)) } - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously /// Contains types and functions for conveniently making code fix assertions using xUnit. [] @@ -201,15 +201,14 @@ module Xunit = /// /// Thrown if a code fix is applied. /// - let expectNoFix (tryFix: string -> CancellableTask) code = - cancellableTask { - match! tryFix code with + let expectNoFix (tryFix: string -> TestCodeFix option) code : Task = + task { + match tryFix code with | None -> () | Some actual -> let e = Assert.ThrowsAny(fun () -> shouldEqual code actual.FixedCode) raise (UnexpectedCodeFixException("Did not expect a code fix but got one anyway.", e)) } - |> CancellableTask.startWithoutCancellation /// /// Expects the given code to be fixed as specified, or, @@ -227,12 +226,12 @@ module Xunit = /// /// Thrown if the generated fix does not match the expected fixed code. /// - let expectFix (tryFix: string -> CancellableTask) code fixedCode = + let expectFix (tryFix: string -> TestCodeFix option) code fixedCode : Task = if code = fixedCode then expectNoFix tryFix code else - cancellableTask { - match! tryFix code with + task { + match tryFix code with | None -> let e = Assert.ThrowsAny(fun () -> shouldEqual fixedCode code) return raise (MissingCodeFixException("Expected a code fix but did not get one.", e)) @@ -243,7 +242,6 @@ module Xunit = with :? Xunit.Sdk.XunitException as e -> return raise (WrongCodeFixException("The applied code fix did not match the expected fix.", e)) } - |> CancellableTask.startWithoutCancellation [] type MemberDataBuilder private () = diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs index 7901df88801..331368cfcb9 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs @@ -7,7 +7,7 @@ open FSharp.Editor.Tests.Helpers open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library open Xunit open CodeFixTestFramework @@ -48,7 +48,7 @@ module private TopLevel = sln, projInfo.Id let private tryFix (code: string) = - cancellableTask { + async2 { let document = let docInfo = RoslynTestHelpers.CreateDocumentInfo projId "C:\\test.fs" code (sln.AddDocument docInfo).GetDocument docInfo.Id @@ -60,9 +60,10 @@ module private TopLevel = return! context - |> ValueOption.either (fixer :> IFSharpCodeFixProvider).GetCodeFixIfAppliesAsync (CancellableTask.singleton ValueNone) - |> CancellableTask.map (ValueOption.map (TestCodeFix.ofFSharpCodeFix sourceText) >> ValueOption.toOption) + |> ValueOption.either (fixer :> IFSharpCodeFixProvider).GetCodeFixIfAppliesAsync (Async2.fromValue ValueNone) + |> Async2.map (ValueOption.map (TestCodeFix.ofFSharpCodeFix sourceText) >> ValueOption.toOption) } + |> Async2.RunSynchronously let expectFix = expectFix tryFix diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index 942701b37b9..18764327575 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -2,7 +2,7 @@ namespace FSharp.Editor.Tests -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module CompletionProviderTests = @@ -33,11 +33,9 @@ module CompletionProviderTests = |> RoslynTestHelpers.GetSingleDocument let results = - let task = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) - |> CancellableTask.start CancellationToken.None - - task.Result |> Seq.map (fun result -> result.DisplayText) + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) + |> Async2.RunSynchronously + |> Seq.map (fun result -> result.DisplayText) let expectedFound = expected |> List.filter results.Contains @@ -81,11 +79,8 @@ module CompletionProviderTests = |> RoslynTestHelpers.GetSingleDocument let actual = - let task = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) - |> CancellableTask.start CancellationToken.None - - task.Result + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) + |> Async2.RunSynchronously |> Seq.toList // sort items as Roslyn do - by `SortText` |> List.sortBy (fun x -> x.SortText) @@ -116,11 +111,8 @@ module CompletionProviderTests = |> RoslynTestHelpers.GetSingleDocument let actual = - let task = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), genBodyForOverriddenMeth) - |> CancellableTask.start CancellationToken.None - - task.Result + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), genBodyForOverriddenMeth) + |> Async2.RunSynchronously |> Seq.toList |> List.choose (fun x -> if expected.ContainsKey x.DisplayText then diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs index 51efbb4fcf2..41b9ae4b676 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs @@ -8,26 +8,20 @@ open Microsoft.VisualStudio.FSharp.Editor open FSharp.Editor.Tests.Helpers open FSharp.Test open System.Threading -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library type DocumentDiagnosticAnalyzerTests() = let startMarker = "(*start*)" let endMarker = "(*end*)" member private _.getDiagnostics(fileContents: string, ?additionalFlags) = - let task = - cancellableTask { - let document = - RoslynTestHelpers.CreateSolution(fileContents, ?extraFSharpProjectOtherOptions = additionalFlags) - |> RoslynTestHelpers.GetSingleDocument - - let! syntacticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) - let! semanticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) - return syntacticDiagnostics.AddRange(semanticDiagnostics) - } - |> CancellableTask.start CancellationToken.None - - task.Result + let document = + RoslynTestHelpers.CreateSolution(fileContents, ?extraFSharpProjectOtherOptions = additionalFlags) + |> RoslynTestHelpers.GetSingleDocument + + let syntacticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) |> Async2.RunSynchronously + let semanticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) |> Async2.RunSynchronously + syntacticDiagnostics.AddRange(semanticDiagnostics) member private this.VerifyNoErrors(fileContents: string, ?additionalFlags: string[]) = let errors = this.getDiagnostics (fileContents, ?additionalFlags = additionalFlags) diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentHighlightsServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentHighlightsServiceTests.fs index 600e52c4024..57ce58773bd 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentHighlightsServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentHighlightsServiceTests.fs @@ -3,7 +3,7 @@ namespace FSharp.Editor.Tests open FSharp.Editor.Tests.Helpers -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module DocumentHighlightsServiceTests = @@ -21,11 +21,8 @@ module DocumentHighlightsServiceTests = RoslynTestHelpers.CreateSolution(fileContents) |> RoslynTestHelpers.GetSingleDocument - let task = - FSharpDocumentHighlightsService.GetDocumentHighlights(document, caretPosition) - |> CancellableTask.start CancellationToken.None - - task.Result + FSharpDocumentHighlightsService.GetDocumentHighlights(document, caretPosition) + |> Async2.RunSynchronously let private span sourceText isDefinition (startLine, startCol) (endLine, endCol) = let range = diff --git a/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs index 985abc67e31..fb166b4f8ba 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/EditorFormattingServiceTests.fs @@ -10,6 +10,7 @@ open FSharp.Compiler.CodeAnalysis open Microsoft.CodeAnalysis.Formatting open FSharp.Editor.Tests.Helpers open FSharp.Test +open Internal.Utilities.Library type EditorFormattingServiceTests() = let filePath = "C:\\test.fs" @@ -82,7 +83,7 @@ marker4""" position, System.Threading.CancellationToken.None ) - |> Async.RunSynchronously + |> Async2.RunSynchronously match changesOpt with | None -> failwith "Expected a text change, but got None" @@ -146,7 +147,7 @@ somethingElseHere clipboard, span ) - |> Async.RunSynchronously + |> Async2.RunSynchronously |> Option.map List.ofSeq if enabled then @@ -213,7 +214,7 @@ somethingElseHere clipboard, span ) - |> Async.RunSynchronously + |> Async2.RunSynchronously |> Option.map List.ofSeq match changesOpt with @@ -277,7 +278,7 @@ somethingElseHere clipboard, span ) - |> Async.RunSynchronously + |> Async2.RunSynchronously |> Option.map List.ofSeq match changesOpt with diff --git a/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs index eac0c3f6e52..b72b62a405d 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs @@ -9,7 +9,7 @@ open Xunit open Microsoft.VisualStudio.FSharp.Editor open FSharp.Compiler.CodeAnalysis open FSharp.Editor.Tests.Helpers -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library // AppDomain helper type Worker() = @@ -31,11 +31,8 @@ type Worker() = let expected = expected |> Seq.toList let actual = - let x = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) - |> CancellableTask.start CancellationToken.None - - x.Result + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) + |> Async2.RunSynchronously |> Seq.toList // sort items as Roslyn do - by `SortText` |> List.sortBy (fun x -> x.SortText) diff --git a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs index d0e4b5efad1..813e3014aa1 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs @@ -9,7 +9,7 @@ open Microsoft.VisualStudio.FSharp.Editor open FSharp.Compiler.EditorServices open FSharp.Compiler.Text open FSharp.Editor.Tests.Helpers -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library open System.Threading module GoToDefinitionServiceTests = @@ -41,7 +41,7 @@ module GoToDefinitionServiceTests = let _, checkFileResults = document.GetFSharpParseAndCheckResultsAsync(nameof (userOpName)) - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously let declarations = checkFileResults.GetDeclarationLocation( diff --git a/vsintegration/tests/FSharp.Editor.Tests/HelpContextServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/HelpContextServiceTests.fs index e8a1588f13b..281eb72faa6 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/HelpContextServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/HelpContextServiceTests.fs @@ -10,7 +10,7 @@ open Microsoft.VisualStudio.FSharp.Editor open Microsoft.IO open FSharp.Editor.Tests.Helpers open Microsoft.CodeAnalysis.Text -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library type HelpContextServiceTests() = let getMarkers (source: string) = @@ -56,11 +56,8 @@ type HelpContextServiceTests() = CancellationToken.None ) - let task = - FSharpHelpContextService.GetHelpTerm(document, span, classifiedSpans) - |> CancellableTask.start CancellationToken.None - - task.Result + FSharpHelpContextService.GetHelpTerm(document, span, classifiedSpans) + |> Async2.RunSynchronously ] let equalLength = (expectedKeywords.Length = res.Length) diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs index df6d3c73c0c..80420f8229d 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs @@ -8,7 +8,7 @@ open Microsoft.VisualStudio.FSharp.Editor.Hints open Hints open FSharp.Editor.Tests.Helpers open System.Threading -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module HintTestFramework = @@ -36,24 +36,17 @@ module HintTestFramework = } let getHints (document: Document) hintKinds = - let task = - cancellableTask { - let! ct = CancellableTask.getCancellationToken () + let sourceText = document.GetTextAsync(CancellationToken.None).Result + let hints = HintService.getHintsForDocument sourceText document hintKinds "test" |> Async2.RunSynchronously - let getTooltip hint = - async { - let! roslynTexts = hint.GetTooltip document - return roslynTexts |> Seq.map (fun roslynText -> roslynText.Text) |> String.concat "" - } + let getTooltip hint = + hint.GetTooltip document + |> Async2.RunSynchronously + |> Seq.map (fun roslynText -> roslynText.Text) + |> String.concat "" - let! sourceText = document.GetTextAsync ct |> Async.AwaitTask - let! hints = HintService.getHintsForDocument sourceText document hintKinds "test" ct - let! tooltips = hints |> Seq.map getTooltip |> Async.Parallel - return tooltips |> Seq.zip hints |> Seq.map convert - } - |> CancellableTask.start CancellationToken.None - - task.Result + let tooltips = hints |> Seq.map getTooltip |> Seq.toArray + tooltips |> Seq.zip hints |> Seq.map convert let getTypeHints document = getHints document (set [ HintKind.TypeHint ]) diff --git a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs index 18cff0490e9..71c7303bcbe 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs @@ -11,7 +11,7 @@ open Microsoft.VisualStudio.FSharp.Editor open Microsoft.VisualStudio.FSharp.Editor.QuickInfo open FSharp.Editor.Tests.Helpers open FSharp.Test -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library type public AssemblyResolverTestFixture() = @@ -96,11 +96,8 @@ module QuickInfoProviderTests = let caretPosition = programText.IndexOf(symbol) + symbol.Length - 1 let quickInfo = - let task = - FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition) - |> CancellableTask.start CancellationToken.None - - task.Result + FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition) + |> Async2.RunSynchronously let actual = quickInfo diff --git a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs index 1bf2aba3af5..8be322bbd74 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs @@ -7,7 +7,7 @@ open Microsoft.VisualStudio.FSharp.Editor open Microsoft.VisualStudio.FSharp.Editor.QuickInfo open Xunit open FSharp.Editor.Tests.Helpers -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module QuickInfo = open FSharp.Compiler.EditorServices @@ -36,12 +36,10 @@ module QuickInfo = let! _, _, _, tooltip = FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition) - |> CancellableTask.start CancellationToken.None - |> Async.AwaitTask return tooltip } - |> Async.RunSynchronously + |> Async2.RunSynchronously let GetQuickInfoTextFromCode (codeWithCaret: string) = let caretPosition, code = GetCaretPosition codeWithCaret diff --git a/vsintegration/tests/FSharp.Editor.Tests/SemanticClassificationServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SemanticClassificationServiceTests.fs index 7338e794c8b..1a14a05c468 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SemanticClassificationServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SemanticClassificationServiceTests.fs @@ -10,23 +10,21 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Classification open FSharp.Editor.Tests.Helpers open FSharp.Test -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library type SemanticClassificationServiceTests() = let getRanges (source: string) : SemanticClassificationItem list = asyncMaybe { - let! ct = Async.CancellationToken |> liftAsync - let document = RoslynTestHelpers.CreateSolution(source) |> RoslynTestHelpers.GetSingleDocument let! _, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("SemanticClassificationServiceTests") - |> CancellableTask.start ct + |> liftAsync return checkFileResults.GetSemanticClassification(None) } - |> Async.RunSynchronously + |> Async2.RunSynchronously |> Option.toList |> List.collect Array.toList diff --git a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs index 398ece88fa3..44573a981c0 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs @@ -13,6 +13,7 @@ open Microsoft.CodeAnalysis open Microsoft.IO open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks open FSharp.Test +open Internal.Utilities.Library module SignatureHelpProvider = let private DefaultDocumentationProvider = @@ -42,7 +43,7 @@ module SignatureHelpProvider = let parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("GetSignatureHelp") - |> CancellableTask.runSynchronously ct + |> Async2.run ct let paramInfoLocations = parseResults.FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn).Value @@ -59,7 +60,7 @@ module SignatureHelpProvider = triggerChar, EditorOptions() ) - |> Async.RunSynchronously + |> Async2.RunSynchronously return triggered } @@ -106,7 +107,7 @@ module SignatureHelpProvider = let parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("assertSignatureHelpForMethodCalls") - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously let actual = let paramInfoLocations = @@ -127,7 +128,7 @@ module SignatureHelpProvider = triggerChar, EditorOptions() ) - |> Async.RunSynchronously + |> Async2.RunSynchronously checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() @@ -154,7 +155,7 @@ module SignatureHelpProvider = let parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("assertSignatureHelpForFunctionApplication") - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously let adjustedColumnInSource = let rec loop pos = @@ -185,7 +186,7 @@ module SignatureHelpProvider = filePath, EditorOptions() ) - |> Async.RunSynchronously + |> Async2.RunSynchronously checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() @@ -503,7 +504,7 @@ M.f let parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("function application in single pipeline with no additional args") - |> CancellableTask.runSynchronouslyWithoutCancellation + |> Async2.RunSynchronously let adjustedColumnInSource = let rec loop ch pos = @@ -529,7 +530,7 @@ M.f filePath, EditorOptions() ) - |> Async.RunSynchronously + |> Async2.RunSynchronously checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index 684ae3a6c84..4001dbc99cc 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -20,7 +20,7 @@ open Microsoft.VisualStudio.LanguageServices open Microsoft.VisualStudio.Shell open VisualFSharp.UnitTests.Editor open Xunit -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks +open Internal.Utilities.Library module WorkspaceTests = @@ -167,14 +167,14 @@ module WorkspaceTests = let assertEmptyDocumentDiagnostics (workspace: Workspace) (filePath: string) = let doc = getDocument workspace filePath - let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation + let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> Async2.RunSynchronously Assert.Empty(parseResults.Diagnostics) Assert.Empty(checkResults.Diagnostics) let assertHasDocumentDiagnostics (workspace: Workspace) (filePath: string) = let doc = getDocument workspace filePath - let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation + let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> Async2.RunSynchronously Assert.Empty(parseResults.Diagnostics) Assert.NotEmpty(checkResults.Diagnostics) From c018a6435bcba10aabb34d4c09ba049b671df362 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Sat, 28 Feb 2026 08:57:14 +0100 Subject: [PATCH 25/43] get rid of the file --- .../FSharp.Compiler.LanguageServer.fsproj | 1 - .../Handlers/LanguageFeaturesHandler.fs | 11 +- .../FSharp.Editor/Common/CancellableTasks.fs | 1153 ----------------- .../src/FSharp.Editor/FSharp.Editor.fsproj | 1 - .../LanguageService/SymbolHelpers.fs | 1 - 5 files changed, 5 insertions(+), 1162 deletions(-) delete mode 100644 vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs diff --git a/src/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj b/src/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj index d6ebfc1c6f6..ee13e864856 100644 --- a/src/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj +++ b/src/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj @@ -32,7 +32,6 @@ - diff --git a/src/FSharp.Compiler.LanguageServer/Handlers/LanguageFeaturesHandler.fs b/src/FSharp.Compiler.LanguageServer/Handlers/LanguageFeaturesHandler.fs index 474758924d0..8c541fe5572 100644 --- a/src/FSharp.Compiler.LanguageServer/Handlers/LanguageFeaturesHandler.fs +++ b/src/FSharp.Compiler.LanguageServer/Handlers/LanguageFeaturesHandler.fs @@ -2,13 +2,12 @@ open Microsoft.CommonLanguageServerProtocol.Framework open Microsoft.VisualStudio.LanguageServer.Protocol -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks open FSharp.Compiler.LanguageServer.Common open FSharp.Compiler.LanguageServer open System.Threading.Tasks open System.Threading open System.Collections.Generic -open Microsoft.VisualStudio.FSharp.Editor +open Internal.Utilities.Library #nowarn "57" @@ -25,7 +24,7 @@ type LanguageFeaturesHandler() = member _.HandleRequestAsync (request: DocumentDiagnosticParams, context: FSharpRequestContext, cancellationToken: CancellationToken) = - cancellableTask { + async2 { let! fsharpDiagnosticReport = context.Workspace.Query.GetDiagnosticsForFile request.TextDocument.Uri @@ -47,13 +46,13 @@ type LanguageFeaturesHandler() = RelatedFullDocumentDiagnosticReport(RelatedDocuments = relatedDocuments) ) } - |> CancellableTask.start cancellationToken + |> Async2.startAsTask cancellationToken interface IRequestHandler with [] member _.HandleRequestAsync(request: SemanticTokensParams, context: FSharpRequestContext, cancellationToken: CancellationToken) = - cancellableTask { + async2 { let! tokens = context.GetSemanticTokensForFile(request.TextDocument.Uri) return SemanticTokens(Data = tokens) } - |> CancellableTask.start cancellationToken + |> Async2.startAsTask cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs b/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs deleted file mode 100644 index 5056ddee461..00000000000 --- a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs +++ /dev/null @@ -1,1153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -// -// Implementation is taken from IcedTasks (https://github.com/TheAngryByrd/IcedTasks/blob/72638c8719014ae963f2662449c99f87090041d1/LICENSE.md?plain=1#L1-L21), under MIT license -// Which was originally written in 2016 by Robert Peele (humbobst@gmail.com) -// New operator-based overload resolution for F# 4.0 compatibility by Gustavo Leon in 2018. -// Revised for insertion into FSharp.Core by Microsoft, 2019. -// Revised to implement CancellationToken semantics -// -// Original notice: -// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights -// to this software to the public domain worldwide. This software is distributed without any warranty. -// IcedTasks MIT notice (https://github.com/TheAngryByrd/IcedTasks/blob/72638c8719014ae963f2662449c99f87090041d1/LICENSE.md?plain=1#L1-L21): -// MIT License - -// Copyright (c) [year] [fullname] - -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -namespace Microsoft.VisualStudio.FSharp.Editor - -// Don't warn about the resumable code invocation -#nowarn "3513" - -module CancellableTasks = - - open System - open System.Runtime.CompilerServices - open System.Threading - open System.Threading.Tasks - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.CompilerServices - open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers - open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Collections - - [] - type VolatileBarrier() = - - [] - let mutable isStopped = false - - member _.Proceed = not isStopped - member _.Stop() = isStopped <- true - - /// A type that looks like an Awaiter - type Awaiter<'Awaiter, 'TResult - when 'Awaiter :> ICriticalNotifyCompletion - and 'Awaiter: (member IsCompleted: bool) - and 'Awaiter: (member GetResult: unit -> 'TResult)> = 'Awaiter - - /// A type that looks like an Awaitable - type Awaitable<'Awaitable, 'Awaiter, 'TResult - when 'Awaitable: (member GetAwaiter: unit -> Awaiter<'Awaiter, 'TResult>)> = 'Awaitable - - /// Functions for Awaiters - module Awaiter = - /// Gets a value that indicates whether the asynchronous task has completed - let inline isCompleted<'Awaiter, 'TResult when Awaiter<'Awaiter, 'TResult>> (x: 'Awaiter) = - x.IsCompleted - - /// Ends the wait for the completion of the asynchronous task. - let inline getResult<'Awaiter, 'TResult when Awaiter<'Awaiter, 'TResult>> (x: 'Awaiter) = - x.GetResult() - - /// Functions for Awaitables - module Awaitable = - /// Creates an awaiter for this value. - let inline getAwaiter<'Awaitable, 'Awaiter, 'TResult - when Awaitable<'Awaitable, 'Awaiter, 'TResult>> - (x: 'Awaitable) - = - x.GetAwaiter() - - /// CancellationToken -> Task<'T> - type CancellableTask<'T> = CancellationToken -> Task<'T> - - /// CancellationToken -> Task - type CancellableTask = CancellationToken -> Task - - /// The extra data stored in ResumableStateMachine for tasks - [] - type CancellableTaskStateMachineData<'T> = - [] - val mutable CancellationToken: CancellationToken - - [] - val mutable Result: 'T - - [] - val mutable MethodBuilder: AsyncTaskMethodBuilder<'T> - - member inline this.ThrowIfCancellationRequested() = - this.CancellationToken.ThrowIfCancellationRequested() - - /// This is used by the compiler as a template for creating state machine structs - and CancellableTaskStateMachine<'TOverall> = - ResumableStateMachine> - - /// Represents the runtime continuation of a CancellableTask state machine created dynamically - and CancellableTaskResumptionFunc<'TOverall> = - ResumptionFunc> - - /// Represents the runtime continuation of a CancellableTask state machine created dynamically - and CancellableTaskResumptionDynamicInfo<'TOverall> = - ResumptionDynamicInfo> - - /// A special compiler-recognised delegate type for specifying blocks of CancellableTask code with access to the state machine - and CancellableTaskCode<'TOverall, 'T> = - ResumableCode, 'T> - - - /// Contains methods to build CancellableTasks using the F# computation expression syntax - [] - type CancellableTaskBuilderBase() = - - /// Creates a CancellableTask that runs generator - /// The function to run - /// A cancellableTask that runs generator - member inline _.Delay - ([] generator: unit -> CancellableTaskCode<'TOverall, 'T>) - : CancellableTaskCode<'TOverall, 'T> = - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - (generator ()).Invoke(&sm) - ) - - - /// Creates an CancellableTask that just returns (). - /// - /// The existence of this method permits the use of empty else branches in the - /// cancellableTask { ... } computation expression syntax. - /// - /// An CancellableTask that returns (). - [] - member inline _.Zero() : CancellableTaskCode<'TOverall, unit> = ResumableCode.Zero() - - /// Creates an computation that returns the result v. - /// - /// A cancellation check is performed when the computation is executed. - /// - /// The existence of this method permits the use of return in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The value to return from the computation. - /// - /// An CancellableTask that returns value when executed. - member inline _.Return(value: 'T) : CancellableTaskCode<'T, 'T> = - CancellableTaskCode<'T, _>(fun sm -> - sm.Data.ThrowIfCancellationRequested() - sm.Data.Result <- value - true - ) - - /// Creates an CancellableTask that first runs task1 - /// and then runs computation2, returning the result of computation2. - /// - /// - /// - /// The existence of this method permits the use of expression sequencing in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The first part of the sequenced computation. - /// The second part of the sequenced computation. - /// - /// An CancellableTask that runs both of the computations sequentially. - member inline _.Combine - ( - task1: CancellableTaskCode<'TOverall, unit>, - task2: CancellableTaskCode<'TOverall, 'T> - ) : CancellableTaskCode<'TOverall, 'T> = - ResumableCode.Combine( - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - task1.Invoke(&sm) - ), - - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - task2.Invoke(&sm) - ) - ) - - /// Creates an CancellableTask that runs computation repeatedly - /// until guard() becomes false. - /// - /// - /// - /// The existence of this method permits the use of while in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The function to determine when to stop executing computation. - /// The function to be executed. Equivalent to the body - /// of a while expression. - /// - /// An CancellableTask that behaves similarly to a while loop when run. - member inline _.While - ( - [] guard: unit -> bool, - computation: CancellableTaskCode<'TOverall, unit> - ) : CancellableTaskCode<'TOverall, unit> = - ResumableCode.While( - guard, - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - computation.Invoke(&sm) - ) - ) - - /// Creates an CancellableTask that runs computation and returns its result. - /// If an exception happens then catchHandler(exn) is called and the resulting computation executed instead. - /// - /// - /// - /// The existence of this method permits the use of try/with in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The input computation. - /// The function to run when computation throws an exception. - /// - /// An CancellableTask that executes computation and calls catchHandler if an - /// exception is thrown. - member inline _.TryWith - ( - computation: CancellableTaskCode<'TOverall, 'T>, - [] catchHandler: exn -> CancellableTaskCode<'TOverall, 'T> - ) : CancellableTaskCode<'TOverall, 'T> = - ResumableCode.TryWith( - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - computation.Invoke(&sm) - ), - catchHandler - ) - - /// Creates an CancellableTask that runs computation. The action compensation is executed - /// after computation completes, whether computation exits normally or by an exception. If compensation raises an exception itself - /// the original exception is discarded and the new exception becomes the overall result of the computation. - /// - /// - /// - /// The existence of this method permits the use of try/finally in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The input computation. - /// The action to be run after computation completes or raises an - /// exception (including cancellation). - /// - /// An CancellableTask that executes computation and compensation afterwards or - /// when an exception is raised. - member inline _.TryFinally - ( - computation: CancellableTaskCode<'TOverall, 'T>, - [] compensation: unit -> unit - ) : CancellableTaskCode<'TOverall, 'T> = - ResumableCode.TryFinally( - - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - computation.Invoke(&sm) - ), - ResumableCode<_, _>(fun _ -> - compensation () - true - ) - ) - - /// Creates an CancellableTask that enumerates the sequence seq - /// on demand and runs body for each element. - /// - /// A cancellation check is performed on each iteration of the loop. - /// - /// The existence of this method permits the use of for in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The sequence to enumerate. - /// A function to take an item from the sequence and create - /// an CancellableTask. Can be seen as the body of the for expression. - /// - /// An CancellableTask that will enumerate the sequence and run body - /// for each element. - member inline _.For - ( - sequence: seq<'T>, - [] body: 'T -> CancellableTaskCode<'TOverall, unit> - ) : CancellableTaskCode<'TOverall, unit> = - ResumableCode.For( - sequence, - fun item -> - CancellableTaskCode(fun sm -> - sm.Data.ThrowIfCancellationRequested() - (body item).Invoke(&sm) - ) - ) - - /// Contains methods to build CancellableTasks using the F# computation expression syntax - [] - type CancellableTaskBuilder(runOnBackground: bool) = - - inherit CancellableTaskBuilderBase() - - member val IsBackground = runOnBackground - - // This is the dynamic implementation - this is not used - // for statically compiled tasks. An executor (resumptionFuncExecutor) is - // registered with the state machine, plus the initial resumption. - // The executor stays constant throughout the execution, it wraps each step - // of the execution in a try/with. The resumption is changed at each step - // to represent the continuation of the computation. - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - static member inline RunDynamicAux(code: CancellableTaskCode<'T, 'T>) : CancellableTask<'T> = - - let mutable sm = CancellableTaskStateMachine<'T>() - - let initialResumptionFunc = - CancellableTaskResumptionFunc<'T>(fun sm -> code.Invoke(&sm)) - - let resumptionInfo = - { new CancellableTaskResumptionDynamicInfo<'T>(initialResumptionFunc) with - member info.MoveNext(sm) = - let mutable savedExn = null - - try - sm.ResumptionDynamicInfo.ResumptionData <- null - let step = info.ResumptionFunc.Invoke(&sm) - - if step then - sm.Data.MethodBuilder.SetResult(sm.Data.Result) - else - let mutable awaiter = - sm.ResumptionDynamicInfo.ResumptionData - :?> ICriticalNotifyCompletion | null - - assert not (isNull awaiter) - sm.Data.MethodBuilder.AwaitUnsafeOnCompleted(&awaiter, &sm) - - with exn -> - savedExn <- exn - // Run SetException outside the stack unwind, see https://github.com/dotnet/roslyn/issues/26567 - match savedExn with - | null -> () - | exn -> sm.Data.MethodBuilder.SetException exn - - member _.SetStateMachine(sm, state) = - sm.Data.MethodBuilder.SetStateMachine(state) - } - - fun (ct) -> - if ct.IsCancellationRequested then - Task.FromCanceled<_>(ct) - else - sm.Data.CancellationToken <- ct - sm.ResumptionDynamicInfo <- resumptionInfo - sm.Data.MethodBuilder <- AsyncTaskMethodBuilder<'T>.Create() - sm.Data.MethodBuilder.Start(&sm) - sm.Data.MethodBuilder.Task - - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - static member inline RunDynamic(code: CancellableTaskCode<'T, 'T>, runOnBackground: bool) : CancellableTask<'T> = - // When runOnBackground is true, task escapes to a background thread where necessary - // See spec of ConfigureAwait(false) at https://devblogs.microsoft.com/dotnet/configureawait-faq/ - - if runOnBackground - && not (isNull SynchronizationContext.Current - && obj.ReferenceEquals(TaskScheduler.Current, TaskScheduler.Default)) - then - fun (ct) -> - Task.Run<'T>((fun () -> CancellableTaskBuilder.RunDynamicAux (code) (ct)), ct) - else - CancellableTaskBuilder.RunDynamicAux(code) - - - /// Hosts the task code in a state machine and starts the task. - member inline this.Run(code: CancellableTaskCode<'T, 'T>) : CancellableTask<'T> = - if __useResumableCode then - __stateMachine, CancellableTask<'T>> - (MoveNextMethodImpl<_>(fun sm -> - //-- RESUMABLE CODE START - __resumeAt sm.ResumptionPoint - let mutable __stack_exn: Exception | null = null - - try - let __stack_code_fin = code.Invoke(&sm) - - if __stack_code_fin then - sm.Data.MethodBuilder.SetResult(sm.Data.Result) - with exn -> - __stack_exn <- exn - // Run SetException outside the stack unwind, see https://github.com/dotnet/roslyn/issues/26567 - match __stack_exn with - | null -> () - | exn -> sm.Data.MethodBuilder.SetException exn - //-- RESUMABLE CODE END - )) - (SetStateMachineMethodImpl<_>(fun sm state -> - sm.Data.MethodBuilder.SetStateMachine(state) - )) - (AfterCode<_, _>(fun sm -> - if this.IsBackground - && not (isNull SynchronizationContext.Current - && obj.ReferenceEquals(TaskScheduler.Current, TaskScheduler.Default)) - then - - let sm = sm // copy contents of state machine so we can capture it - - fun (ct) -> - if ct.IsCancellationRequested then - Task.FromCanceled<_>(ct) - else - // Warning: this will always try to yield even if on thread pool already. - Task.Run<'T>( - (fun () -> - let mutable sm = sm // host local mutable copy of contents of state machine on this thread pool thread - sm.Data.CancellationToken <- ct - - sm.Data.MethodBuilder <- - AsyncTaskMethodBuilder<'T>.Create() - - sm.Data.MethodBuilder.Start(&sm) - sm.Data.MethodBuilder.Task - ), - ct - ) - else - let mutable sm = sm - - fun (ct) -> - if ct.IsCancellationRequested then - Task.FromCanceled<_>(ct) - else - sm.Data.CancellationToken <- ct - sm.Data.MethodBuilder <- AsyncTaskMethodBuilder<'T>.Create() - sm.Data.MethodBuilder.Start(&sm) - sm.Data.MethodBuilder.Task - )) - else - CancellableTaskBuilder.RunDynamic(code, this.IsBackground) - - /// Contains the cancellableTask computation expression builder. - [] - module CancellableTaskBuilder = - - /// - /// Builds a cancellableTask using computation expression syntax. - /// Default behaviour when binding (v)options is to return a cancelled task. - /// - let foregroundCancellableTask = CancellableTaskBuilder(false) - - /// - /// Builds a cancellableTask using computation expression syntax which switches to execute on a background thread if not already doing so. - /// Default behaviour when binding (v)options is to return a cancelled task. - /// - let cancellableTask = CancellableTaskBuilder(true) - - /// - [] - module LowPriority = - // Low priority extensions - type CancellableTaskBuilderBase with - - [] - member inline _.Source(awaiter: CancellableTask) = - (fun (token) -> (awaiter token :> Task).GetAwaiter()) - - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - [] - static member inline BindDynamic<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - sm: byref>>, - [] getAwaiter: CancellationToken -> 'Awaiter, - [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall, 'TResult2>) - ) : bool = - sm.Data.ThrowIfCancellationRequested() - - let mutable awaiter = getAwaiter sm.Data.CancellationToken - - let cont: CancellableTaskResumptionFunc<'TOverall> = - (CancellableTaskResumptionFunc<'TOverall>(fun (sm: byref>>) -> - let result: 'TResult1 = Awaiter.getResult awaiter - (continuation result).Invoke(&sm) - )) - - // shortcut to continue immediately - if Awaiter.isCompleted awaiter then - cont.Invoke(&sm) - else - sm.ResumptionDynamicInfo.ResumptionData <- - (awaiter :> ICriticalNotifyCompletion) - - sm.ResumptionDynamicInfo.ResumptionFunc <- cont - false - - /// Creates an CancellableTask that runs computation, and when - /// computation generates a result T, runs binder res. - /// - /// A cancellation check is performed when the computation is executed. - /// - /// The existence of this method permits the use of let! in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The computation to provide an unbound result. - /// The function to bind the result of computation. - /// - /// An CancellableTask that performs a monadic bind on the result - /// of computation. - [] - member inline _.Bind<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - [] getAwaiter: CancellationToken -> 'Awaiter, - [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall, 'TResult2>) - ) : CancellableTaskCode<'TOverall, 'TResult2> = - - CancellableTaskCode<'TOverall, _>(fun sm -> - if __useResumableCode then - //-- RESUMABLE CODE START - sm.Data.ThrowIfCancellationRequested() - // Get an awaiter from the Awaiter - let mutable awaiter = getAwaiter sm.Data.CancellationToken - - let mutable __stack_fin = true - - if not (Awaiter.isCompleted awaiter) then - // This will yield with __stack_yield_fin = false - // This will resume with __stack_yield_fin = true - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_fin <- __stack_yield_fin - - if __stack_fin then - let result = - awaiter - |> Awaiter.getResult - - (continuation result).Invoke(&sm) - else - sm.Data.MethodBuilder.AwaitUnsafeOnCompleted(&awaiter, &sm) - false - else - CancellableTaskBuilderBase.BindDynamic<'TResult1, 'TResult2, 'Awaiter, 'TOverall>( - &sm, - getAwaiter, - continuation - ) - //-- RESUMABLE CODE END - ) - - - /// - /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code. - /// - [] - static member inline BindDynamic<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - sm: byref>>, - getAwaiter: 'Awaiter, - [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall, 'TResult2>) - ) : bool = - - sm.Data.ThrowIfCancellationRequested() - - let mutable awaiter = getAwaiter - - let cont = - (CancellableTaskResumptionFunc<'TOverall>(fun sm -> - let result = Awaiter.getResult awaiter - (continuation result).Invoke(&sm))) - - // shortcut to continue immediately - if Awaiter.isCompleted awaiter then - cont.Invoke(&sm) - else - sm.ResumptionDynamicInfo.ResumptionData <- (awaiter :> ICriticalNotifyCompletion) - sm.ResumptionDynamicInfo.ResumptionFunc <- cont - false - - /// Creates an CancellableTask that runs computation, and when - /// computation generates a result T, runs binder res. - /// - /// A cancellation check is performed when the computation is executed. - /// - /// The existence of this method permits the use of let! in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The computation to provide an unbound result. - /// The function to bind the result of computation. - /// - /// An CancellableTask that performs a monadic bind on the result - /// of computation. - [] - member inline _.Bind<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - getAwaiter: 'Awaiter, - [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall, 'TResult2>) - ) : CancellableTaskCode<'TOverall, 'TResult2> = - - CancellableTaskCode<'TOverall, _>( - fun sm -> - if __useResumableCode then - sm.Data.ThrowIfCancellationRequested() - - let mutable awaiter = getAwaiter - let mutable __stack_fin = true - - if not (Awaiter.isCompleted awaiter) then - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_fin <- __stack_yield_fin - - if __stack_fin then - let result = Awaiter.getResult awaiter - - (continuation result).Invoke(&sm) - else - sm.Data.MethodBuilder.AwaitUnsafeOnCompleted(&awaiter, &sm) - false - else - CancellableTaskBuilderBase.BindDynamic<'TResult1, 'TResult2, 'Awaiter, 'TOverall>(&sm, getAwaiter, continuation)) - - - /// Delegates to the input computation. - /// - /// The existence of this method permits the use of return! in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The input computation. - /// - /// The input computation. - [] - member inline this.ReturnFrom<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ([] getAwaiter: CancellationToken -> 'Awaiter) - : CancellableTaskCode<_, _> = - this.Bind(getAwaiter, this.Return) - - [] - member inline this.ReturnFrom<'TResult1, 'TResult2, 'Awaiter, 'TOverall when Awaiter<'Awaiter, 'TResult1>> (getAwaiter: 'Awaiter) : CancellableTaskCode<_, _> = - this.Bind(getAwaiter, (fun v -> this.Return v)) - - - [] - member inline this.BindReturn<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - [] getAwaiter: CancellationToken -> 'Awaiter, - [] mapper: 'TResult1 -> 'TResult2 - ) : CancellableTaskCode<'TResult2, 'TResult2> = - this.Bind(getAwaiter, (fun v -> this.Return(mapper v))) - - - [] - member inline this.BindReturn<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ( - getAwaiter: 'Awaiter, - [] mapper: 'TResult1 -> 'TResult2 - ) : CancellableTaskCode<'TResult2, 'TResult2> = - this.Bind(getAwaiter, (fun v -> this.Return(mapper v))) - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This is the identify function. - /// - /// CancellationToken -> 'Awaiter - [] - member inline _.Source<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - ([] getAwaiter: CancellationToken -> 'Awaiter) - : CancellationToken -> 'Awaiter = - getAwaiter - - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This is the identify function. - /// - /// CancellationToken -> 'Awaiter - [] - member inline _.Source<'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaiter<'Awaiter, 'TResult1>> - (getAwaiter: 'Awaiter) - : 'Awaiter = - getAwaiter - - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a 'Awaitable into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - [] - member inline _.Source<'Awaitable, 'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaitable<'Awaitable, 'Awaiter, 'TResult1>> - (task: 'Awaitable) - : 'Awaiter = - Awaitable.getAwaiter task - - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a CancellationToken -> 'Awaitable into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - [] - member inline _.Source<'Awaitable, 'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaitable<'Awaitable, 'Awaiter, 'TResult1>> - ([] task: CancellationToken -> 'Awaitable) - : CancellationToken -> 'Awaiter = - (fun ct -> Awaitable.getAwaiter (task ct)) - - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a unit -> 'Awaitable into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - [] - member inline _.Source<'Awaitable, 'TResult1, 'TResult2, 'Awaiter, 'TOverall - when Awaitable<'Awaitable, 'Awaiter, 'TResult1>> - ([] task: unit -> 'Awaitable) - : CancellationToken -> 'Awaiter = - (fun _ct -> Awaitable.getAwaiter (task ())) - - - /// Creates an CancellableTask that runs binder(resource). - /// The action resource.Dispose() is executed as this computation yields its result - /// or if the CancellableTask exits by an exception or by cancellation. - /// - /// - /// - /// The existence of this method permits the use of use and use! in the - /// cancellableTask { ... } computation expression syntax. - /// - /// The resource to be used and disposed. - /// The function that takes the resource and returns an asynchronous - /// computation. - /// - /// An CancellableTask that binds and eventually disposes resource. - /// - member inline _.Using<'Resource, 'TOverall, 'T when 'Resource :> IDisposable> - ( - resource: 'Resource, - [] binder: 'Resource -> CancellableTaskCode<'TOverall, 'T> - ) = - ResumableCode.Using( - resource, - fun resource -> - CancellableTaskCode<'TOverall, 'T>(fun sm -> - sm.Data.ThrowIfCancellationRequested() - (binder resource).Invoke(&sm) - ) - ) - - /// - [] - module HighPriority = - - let inline startAsyncImmediateAsTask computation (cancellationToken: CancellationToken) = - // Protect against blocking the UI thread by switching to thread pool - let computation = - match SynchronizationContext.Current with - | null -> computation - | _ -> - async { - do! Async.SwitchToThreadPool() - return! computation - } - - // try not to yield if on bg thread already - let tcs = new TaskCompletionSource<_>(TaskCreationOptions.None) - let barrier = VolatileBarrier() - - let reg = - cancellationToken.Register(fun _ -> - if barrier.Proceed then - tcs.TrySetCanceled(cancellationToken) |> ignore) - - let task = tcs.Task - - let disposeReg () = - barrier.Stop() - - if not task.IsCanceled then - reg.Dispose() - - Async.StartWithContinuations( - computation, - continuation = - (fun result -> - disposeReg () - tcs.TrySetResult(result) |> ignore), - exceptionContinuation = - (fun exn -> - disposeReg () - - match exn with - | :? OperationCanceledException -> tcs.TrySetCanceled(cancellationToken) |> ignore - | exn -> tcs.TrySetException(exn) |> ignore), - cancellationContinuation = - (fun _oce -> - disposeReg () - tcs.TrySetCanceled(cancellationToken) |> ignore), - cancellationToken = cancellationToken - ) - - task - - type Control.Async with - - /// Return an asynchronous computation that will wait for the given task to complete and return - /// its result. - static member inline AwaitCancellableTask([] t: CancellableTask<'T>) = - async { - let! ct = Async.CancellationToken - return! Async.AwaitTask (t ct) - } - - /// Return an asynchronous computation that will wait for the given task to complete and return - /// its result. - static member inline AwaitCancellableTask([] t: CancellableTask) = - async { - let! ct = Async.CancellationToken - - return! Async.AwaitTask (t ct) - } - - /// Runs an asynchronous computation, starting on the current operating system thread. - static member inline AsCancellableTask(computation: Async<'T>) : CancellableTask<_> = - fun ct -> startAsyncImmediateAsTask computation ct - - // High priority extensions - type CancellableTaskBuilderBase with - - /// - /// Turn option into "awaitable", will return cancelled task if None - /// - /// Option instance to bind on - (*member inline _.Source(s: 'T option) = - (fun (_ct: CancellationToken) -> - match s with - | Some x -> Task.FromResult<'T>(x).GetAwaiter() - | None -> Task.FromCanceled<'T>(CancellationToken(true)).GetAwaiter() - )*) - - /// - /// Turn a value option into "awaitable", will return cancelled task if None - /// - /// Option instance to bind on - (*member inline _.Source(s: 'T voption) = - (fun (_ct: CancellationToken) -> - match s with - | ValueSome x -> Task.FromResult<'T>(x).GetAwaiter() - | ValueNone -> Task.FromCanceled<'T>(CancellationToken(true)).GetAwaiter() - )*) - - /// Allows the computation expression to turn other types into other types - /// - /// This is the identify function for For binds. - /// - /// IEnumerable - member inline _.Source(s: #seq<_>) : #seq<_> = s - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a Task<'T> into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - member inline _.Source(task: Task<'T>) = - (fun (_ct: CancellationToken) -> task.GetAwaiter()) - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a ColdTask<'T> into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - member inline _.Source([] task: unit -> Task<'TResult1>) = - (fun (_ct: CancellationToken) -> (task ()).GetAwaiter()) - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a CancellableTask<'T> into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - member inline _.Source([] task: CancellableTask<'TResult1>) = - (fun ct -> (task ct).GetAwaiter()) - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a Async<'T> into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - member inline this.Source(computation: Async<'TResult1>) = - this.Source(fun ct -> Async.AsCancellableTask(computation) ct) - - /// Allows the computation expression to turn other types into CancellationToken -> 'Awaiter - /// - /// This turns a CancellableTask<'T> into a CancellationToken -> 'Awaiter. - /// - /// CancellationToken -> 'Awaiter - member inline _.Source(awaiter: TaskAwaiter<'TResult1>) = awaiter - - /// - /// A set of extension methods making it possible to bind against in async computations. - /// - [] - module AsyncExtensions = - type Control.AsyncBuilder with - - member inline this.Bind([] t: CancellableTask<'T>, [] binder: ('T -> Async<'U>)) : Async<'U> = - this.Bind(Async.AwaitCancellableTask t, binder) - - member inline this.ReturnFrom([] t: CancellableTask<'T>) : Async<'T> = - this.ReturnFrom(Async.AwaitCancellableTask t) - - member inline this.Bind([] t: CancellableTask, [] binder: (unit -> Async<'U>)) : Async<'U> = - this.Bind(Async.AwaitCancellableTask t, binder) - - member inline this.ReturnFrom([] t: CancellableTask) : Async = - this.ReturnFrom(Async.AwaitCancellableTask t) - - /// Contains a set of standard functional helper function - [] - module CancellableTask = - - /// Gets the default cancellation token for executing computations. - /// - /// The default CancellationToken. - /// - /// Cancellation and Exceptions - /// - /// - /// - /// use tokenSource = new CancellationTokenSource() - /// let primes = [ 2; 3; 5; 7; 11 ] - /// for i in primes do - /// let computation = - /// cancellableTask { - /// let! cancellationToken = CancellableTask.getCancellationToken() - /// do! Task.Delay(i * 1000, cancellationToken) - /// printfn $"{i}" - /// } - /// computation tokenSource.Token |> ignore - /// Thread.Sleep(6000) - /// tokenSource.Cancel() - /// printfn "Tasks Finished" - /// - /// This will print "2" 2 seconds from start, "3" 3 seconds from start, "5" 5 seconds from start, cease computation and then - /// followed by "Tasks Finished". - /// - let inline getCancellationToken () : CancellationToken -> Task = - fun ct -> Task.FromResult ct - - /// Lifts an item to a CancellableTask. - /// The item to be the result of the CancellableTask. - /// A CancellableTask with the item as the result. - let inline singleton (item: 'item) : CancellableTask<'item> = fun _ -> Task.FromResult(item) - - /// Allows chaining of CancellableTasks. - /// The continuation. - /// The value. - /// The result of the binder. - let inline bind - ([] binder: 'input -> CancellableTask<'output>) - ([] cTask: CancellableTask<'input>) - = - cancellableTask { - let! cResult = cTask - return! binder cResult - } - - /// Allows chaining of CancellableTasks. - /// The continuation. - /// The value. - /// The result of the mapper wrapped in a CancellableTasks. - let inline map - ([] mapper: 'input -> 'output) - ([] cTask: CancellableTask<'input>) - = - cancellableTask { - let! cResult = cTask - return mapper cResult - } - - /// Allows chaining of CancellableTasks. - /// A function wrapped in a CancellableTasks - /// The value. - /// The result of the applicable. - let inline apply - ([] applicable: CancellableTask<'input -> 'output>) - ([] cTask: CancellableTask<'input>) - = - cancellableTask { - let! applier = applicable - let! cResult = cTask - return applier cResult - } - - /// Takes two CancellableTasks, starts them serially in order of left to right, and returns a tuple of the pair. - /// The left value. - /// The right value. - /// A tuple of the parameters passed in - let inline zip - ([] left: CancellableTask<'left>) - ([] right: CancellableTask<'right>) - = - cancellableTask { - let! r1 = left - let! r2 = right - return r1, r2 - } - - /// Takes two CancellableTask, starts them concurrently, and returns a tuple of the pair. - /// The left value. - /// The right value. - /// A tuple of the parameters passed in. - let inline parallelZip - ([] left: CancellableTask<'left>) - ([] right: CancellableTask<'right>) - = - cancellableTask { - let! ct = getCancellationToken () - let r1 = left ct - let r2 = right ct - let! r1 = r1 - let! r2 = r2 - return r1, r2 - } - - - /// Coverts a CancellableTask to a CancellableTask\<unit\>. - /// The CancellableTask to convert. - /// a CancellableTask\<unit\>. - let inline ofUnit ([] unitCancellabletTask: CancellableTask) = - cancellableTask { - return! unitCancellabletTask - } - - /// Coverts a CancellableTask\<_\> to a CancellableTask. - /// The CancellableTask to convert. - /// A cancellation token. - /// a CancellableTask. - let inline toUnit ([] ctask: CancellableTask<_>) : CancellableTask = - fun ct -> ctask ct - - let inline getAwaiter ([] ctask: CancellableTask<_>) = - fun ct -> (ctask ct).GetAwaiter() - - let inline start ct ([] ctask: CancellableTask<_>) = ctask ct - - let inline startTask ct ([] ctask: CancellableTask) = ctask ct - - let inline startWithoutCancellation ([] ctask: CancellableTask<_>) = start CancellationToken.None ctask - - let inline startTaskWithoutCancellation ([] ctask: CancellableTask) = startTask CancellationToken.None ctask - - let inline runSynchronously ct ([] ctask: CancellableTask<_>) = - let task = start ct ctask - task.GetAwaiter().GetResult() - - let inline runSynchronouslyWithoutCancellation ([] ctask: CancellableTask<_>) = - let task = startWithoutCancellation ctask - task.GetAwaiter().GetResult() - - let inline runTaskSynchronously ct ([] ctask: CancellableTask) = - let task = startTask ct ctask - task.GetAwaiter().GetResult() - - let inline runTaskSynchronouslyWithoutCancellation ([] ctask: CancellableTask) = - let task = startTaskWithoutCancellation ctask - task.GetAwaiter().GetResult() - - let inline startAsTask ct ([] ctask: CancellableTask<_>) = (start ct ctask) :> Task - - let inline startAsTaskWithoutCancellation ([] ctask: CancellableTask<_>) = (start CancellationToken.None ctask) :> Task - - let inline runAsTaskSynchronously ct ([] ctask: CancellableTask<_>) = - let task = startAsTask ct ctask - task.GetAwaiter().GetResult() - - let inline runAsTaskSynchronouslyWithoutCancellation ([] ctask: CancellableTask<_>) = - let task = startAsTaskWithoutCancellation ctask - task.GetAwaiter().GetResult() - - let inline whenAll (tasks: CancellableTask<'a> seq) = - cancellableTask { - let! ct = getCancellationToken () - let tasks = seq { for task in tasks do yield start ct task } - return! Task.WhenAll (tasks) - } - - let inline whenAllTasks (tasks: CancellableTask seq) = - cancellableTask { - let! ct = getCancellationToken () - let tasks = seq { for task in tasks do yield startTask ct task } - return! Task.WhenAll (tasks) - } - - let inline sequential (tasks: CancellableTask<'a> seq) = - cancellableTask { - let! ct = getCancellationToken () - let results = ResizeArray() - for task in tasks do - let! result = start ct task - results.Add(result) - return results - } - - let inline ignore ([] ctask: CancellableTask<_>) = toUnit ctask - - /// If this CancellableTask gets canceled for another reason than the token being canceled, return the specified value. - let inline ifCanceledReturn value (ctask : CancellableTask<_>) = - cancellableTask { - let! ct = getCancellationToken () - - try - return! ctask - with :? OperationCanceledException when ct.IsCancellationRequested = false -> - return value - } - - /// - [] - module MergeSourcesExtensions = - - type CancellableTaskBuilderBase with - - [] - member inline _.MergeSources<'TResult1, 'TResult2, 'Awaiter1, 'Awaiter2 - when Awaiter<'Awaiter1, 'TResult1> and Awaiter<'Awaiter2, 'TResult2>> - ( - [] left: CancellationToken -> 'Awaiter1, - [] right: CancellationToken -> 'Awaiter2 - ) : CancellationToken -> TaskAwaiter<'TResult1 * 'TResult2> = - - cancellableTask { - let! ct = CancellableTask.getCancellationToken () - let leftStarted = left ct - let rightStarted = right ct - let! leftResult = leftStarted - let! rightResult = rightStarted - return leftResult, rightResult - } - |> CancellableTask.getAwaiter diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 62dc457c28d..2ef9627e1a1 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -27,7 +27,6 @@ LegacyResolver.txt - diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs index 679bb347695..ec82e0473bd 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs @@ -15,7 +15,6 @@ open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Symbols open FSharp.Compiler.Text open Microsoft.VisualStudio.FSharp.Editor.Telemetry -open CancellableTasks open Internal.Utilities.Library module internal SymbolHelpers = From 91c91d31043ea81f93e37f53caf00d5756a44577 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Sat, 28 Feb 2026 10:27:00 +0100 Subject: [PATCH 26/43] fix remnants --- build_errors.txt | 214 ------------------ build_errors2.txt | 190 ---------------- .../Refactors/RefactorTestFramework.fs | 10 +- .../SignatureHelpProviderTests.fs | 13 +- 4 files changed, 9 insertions(+), 418 deletions(-) delete mode 100644 build_errors.txt delete mode 100644 build_errors2.txt diff --git a/build_errors.txt b/build_errors.txt deleted file mode 100644 index 9852db63133..00000000000 --- a/build_errors.txt +++ /dev/null @@ -1,214 +0,0 @@ - Determining projects to restore... - All projects are up-to-date for restore. - FSharp.Core -> E:\repos\fsharp\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll - FSharp.DependencyManager.Nuget -> E:\repos\fsharp\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll - FSharp.Compiler.Service -> E:\repos\fsharp\artifacts\bin\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll - FSharp.UIResources -> E:\repos\fsharp\artifacts\bin\FSharp.UIResources\Debug\net472\FSharp.UIResources.dll - FSharp.VS.FSI -> E:\repos\fsharp\artifacts\bin\FSharp.VS.FSI\Debug\net472\FSharp.VS.FSI.dll -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Common\DebugHelpers.fs(124,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(200,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(325,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpAnalysisSaveFileCommandHandler.fs(54,29): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(198,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(358,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(316,17): error FS1182: The value 'solutionEventsOpt' is unused [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(58,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(68,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(67,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b -> Async<'c option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async<'b option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(83,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(111,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(175,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(187,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(255,55): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(258,33): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(259,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(257,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (SemanticClassificationData -> 'b)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(291,52): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(296,54): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(298,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(300,37): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(302,33): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(293,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> CancellableTaskCode<'d,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(25,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(53,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(55,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(54,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(58,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedDeclarationsAnalyzer.fs(28,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(23,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(44,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(156,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(320,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(411,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(41,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(59,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(95,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(151,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(188,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(60,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(115,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(180,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(244,44): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(250,39): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0041: A unique overload for method 'Source' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(256,21): error FS0041: A unique overload for method 'BindReturn' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (TextSpan -> FSharpNavigableItem option)Candidates: - member CancellableTaskBuilderBase.BindReturn: [] getAwaiter: (CancellationToken -> ^Awaiter) * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.BindReturn: getAwaiter: ^Awaiter * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(246,21): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> 'd)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(280,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(365,34): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(369,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(376,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(617,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(629,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(687,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(738,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(782,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(858,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(1064,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigableSymbolsService.fs(43,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinitionService.fs(22,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigationBarItemService.fs(24,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(37,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(147,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(194,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(217,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(31,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(66,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(90,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindDefinitionService.fs(20,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(27,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(77,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(121,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(164,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(24,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] - -Build FAILED. - -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Common\DebugHelpers.fs(124,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(200,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(325,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpAnalysisSaveFileCommandHandler.fs(54,29): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(198,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(358,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(418,24): error FS0001: Type mismatch. Expecting a 'obj -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'obj' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(316,17): error FS1182: The value 'solutionEventsOpt' is unused [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(30,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(58,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(68,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(67,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b -> Async<'c option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async<'b option>)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(83,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(111,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(175,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(187,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(255,55): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(258,33): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(259,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(257,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (SemanticClassificationData -> 'b)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(227,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,32): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(291,52): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(296,54): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(298,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(300,37): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Tasks.Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Tasks.Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(302,33): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (unit -> CancellableTaskCode<'b,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(293,29): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> CancellableTaskCode<'d,unit>)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(262,25): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b voption -> CompilerServices.ResumableCode,unit>) when 'b :> SemanticClassificationLookupCandidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Formatting\BraceMatchingService.fs(49,24): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> System.Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(25,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(53,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(55,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(54,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(58,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\SimplifyNameDiagnosticAnalyzer.fs(61,32): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedDeclarationsAnalyzer.fs(28,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(23,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(44,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\TaskList\TaskListService.fs(27,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Threading.Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(156,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(320,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(411,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\SignatureHelp.fs(621,20): error FS0001: Type mismatch. Expecting a 'Internal.Utilities.Library.Async2 -> 'a' but given a 'CancellableTask<'b> -> Tasks.Task<'b>' The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(41,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(59,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(95,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(151,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(188,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(60,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(115,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(180,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(244,44): error FS0041: No overloads match for method 'Source'.Known type of argument: Internal.Utilities.Library.Async2Available overloads: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> // Argument 'awaiter' doesn't match - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) // Argument 'computation' doesn't match - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'getAwaiter' doesn't match - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq // Argument 's' doesn't match - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) // Argument 'task' doesn't match - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) // Argument 'task' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(250,39): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(257,25): error FS0041: A unique overload for method 'Source' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - member CancellableTaskBuilderBase.Source: [] getAwaiter: (CancellationToken -> ^Awaiter) -> (CancellationToken -> ^Awaiter) when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (CancellationToken -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: (unit -> Task<'TResult1>) -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: [] task: (unit -> ^Awaitable) -> (CancellationToken -> ^Awaiter) when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: [] task: CancellableTask<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: awaiter: CancellableTask -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter) - member CancellableTaskBuilderBase.Source: awaiter: Runtime.CompilerServices.TaskAwaiter<'TResult1> -> Runtime.CompilerServices.TaskAwaiter<'TResult1> - member CancellableTaskBuilderBase.Source: computation: Async<'TResult1> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'TResult1>) - member CancellableTaskBuilderBase.Source: getAwaiter: ^Awaiter -> ^Awaiter when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Source: s: 'a -> 'a when 'a :> 'b seq - member CancellableTaskBuilderBase.Source: task: Task<'T> -> (CancellationToken -> Runtime.CompilerServices.TaskAwaiter<'T>) - member CancellableTaskBuilderBase.Source: task: ^Awaitable -> ^Awaiter when ^Awaitable: (member GetAwaiter: unit -> Awaiter<^Awaiter,'TResult1>) and ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(256,21): error FS0041: A unique overload for method 'BindReturn' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (TextSpan -> FSharpNavigableItem option)Candidates: - member CancellableTaskBuilderBase.BindReturn: [] getAwaiter: (CancellationToken -> ^Awaiter) * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.BindReturn: getAwaiter: ^Awaiter * [] mapper: ('TResult1 -> 'TResult2) -> CancellableTaskCode<'TResult2,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(246,21): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * ('b * 'c -> 'd)Candidates: - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : [] getAwaiter: (CancellationToken -> ^Awaiter) * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) - member CancellableTaskBuilderBase.Bind<'TResult1,'TResult2,^Awaiter,'TOverall when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> : getAwaiter: ^Awaiter * [] continuation: ('TResult1 -> CancellableTaskCode<'TOverall,'TResult2>) -> CancellableTaskCode<'TOverall,'TResult2> when ^Awaiter :> Runtime.CompilerServices.ICriticalNotifyCompletion and ^Awaiter: (member IsCompleted: bool) and ^Awaiter: (member GetResult: unit -> 'TResult1) [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(280,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(361,24): error FS0001: The type 'CancellableTask<'a>' does not match the type 'Internal.Utilities.Library.Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(365,34): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(369,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(376,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(617,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(629,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(687,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(738,21): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(782,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(858,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(1064,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLazy AsyncLocal AsyncQueue [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigableSymbolsService.fs(43,17): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinitionService.fs(22,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigationBarItemService.fs(24,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(37,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(147,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(194,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\NavigateToSearchService.fs(217,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(31,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(66,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(90,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindDefinitionService.fs(20,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(27,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(77,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(121,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async AsyncLocal asyncMaybe AsyncLocal [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(164,13): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(24,9): error FS0039: The value or constructor 'async2' is not defined. Maybe you want one of the following: async Async asyncMaybe AsyncReturn AsyncBuilder [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] - 0 Warning(s) - 100 Error(s) - -Time Elapsed 00:00:08.54 diff --git a/build_errors2.txt b/build_errors2.txt deleted file mode 100644 index e32890ea784..00000000000 --- a/build_errors2.txt +++ /dev/null @@ -1,190 +0,0 @@ - Determining projects to restore... - All projects are up-to-date for restore. - FSharp.Core -> E:\repos\fsharp\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll - FSharp.DependencyManager.Nuget -> E:\repos\fsharp\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll - FSharp.Compiler.Service -> E:\repos\fsharp\artifacts\bin\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll - FSharp.VS.FSI -> E:\repos\fsharp\artifacts\bin\FSharp.VS.FSI\Debug\net472\FSharp.VS.FSI.dll - FSharp.UIResources -> E:\repos\fsharp\artifacts\bin\FSharp.UIResources\Debug\net472\FSharp.UIResources.dll -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(216,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(225,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(437,29): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(347,42): error FS0008: This runtime coercion or type test from type 'a  to  OleMenuCommandService involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(371,36): error FS0008: This runtime coercion or type test from type 'a  to  IVsSolution involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(376,31): error FS0008: This runtime coercion or type test from type 'a  to  IVsRunningDocumentTable involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(171,21): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(163,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(216,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(304,20): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(30,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(33,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(38,38): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(39,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(60,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(72,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(133,40): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,65): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(142,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(33,82): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(162,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(163,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(164,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(165,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(166,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(50,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(52,55): error FS0041: A unique overload for method 'WithDocumentText' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: DocumentId * 'aCandidates: - Solution.WithDocumentText(documentId: DocumentId, text: SourceText, ?mode: PreservationMode) : Solution - Solution.WithDocumentText(documentId: DocumentId, textAndVersion: TextAndVersion, ?mode: PreservationMode) : Solution [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(101,9): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(191,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(192,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(193,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(208,25): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(76,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(77,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(78,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(380,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(381,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(383,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(384,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(804,27): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(94,30): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,13): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(88,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(89,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(90,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(176,16): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: cancellationToken [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(29,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(30,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(31,24): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(34,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(37,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,97): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,119): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(58,37): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(84,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(117,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(124,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(68,26): error FS0041: No overloads match for method 'Create'.Known types of arguments: System.String * Async2 * System.StringAvailable overloads: - CodeAction.Create(title: string, createChangedDocument: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool) : CodeAction // Argument 'nestedActions' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool, ?priority: CodeActionPriority) : CodeAction // Argument 'nestedActions' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(83,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(84,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(85,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(82,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(172,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\ImplementInterface.fs(260,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(54,92): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(57,66): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(38,49): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(42,40): error FS0039: The type 'Unit' does not define the field, constructor or member 'ToImmutableArray'. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] - -Build FAILED. - -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(216,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(225,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\FSharpProjectOptionsManager.fs(437,29): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(347,42): error FS0008: This runtime coercion or type test from type 'a  to  OleMenuCommandService involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(371,36): error FS0008: This runtime coercion or type test from type 'a  to  IVsSolution involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\LanguageService.fs(376,31): error FS0008: This runtime coercion or type test from type 'a  to  IVsRunningDocumentTable involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(34,113): error FS0001: Type mismatch. Expecting a 'Async2 -> 'a' but given a 'Async<'b> -> Async<'b option>' The type 'Async<'a>' does not match the type 'Async2' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(38,13): error FS0041: A unique overload for method 'Bind' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: 'a * (string list * string * bool option -> Async)Candidates: - member AsyncMaybeBuilder.Bind: value: 'T option * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: 'T voption * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Async<'T option> * [] f: ('T -> Async<'U option>) -> Async<'U option> - member AsyncMaybeBuilder.Bind: value: Task<'T> * [] f: ('T -> Async<'U option>) -> Async<'U option> [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(97,21): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(171,21): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0001: This expression was expected to have type 'unit array' but here has type 'unit' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\LanguageService\SymbolHelpers.fs(181,17): error FS0025: Incomplete pattern matches on this expression. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(163,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(216,17): error FS0039: The value or constructor 'cancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Classification\ClassificationService.fs(304,20): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: CancellationToken cancellationToken CancellationTokenSource [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(30,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(33,17): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(38,38): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\BreakpointResolutionService.fs(39,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Debugging\LanguageDebugInfoService.fs(60,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnnecessaryParenthesesDiagnosticAnalyzer.fs(72,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(133,40): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(137,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(140,65): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\DocumentDiagnosticAnalyzer.fs(142,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Diagnostics\UnusedOpensDiagnosticAnalyzer.fs(33,82): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(162,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(163,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(164,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(165,49): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(166,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Completion\CompletionProvider.fs(180,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(50,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(52,55): error FS0041: A unique overload for method 'WithDocumentText' could not be determined based on type information prior to this program point. A type annotation may be needed.Known types of arguments: DocumentId * 'aCandidates: - Solution.WithDocumentText(documentId: DocumentId, text: SourceText, ?mode: PreservationMode) : Solution - Solution.WithDocumentText(documentId: DocumentId, textAndVersion: TextAndVersion, ?mode: PreservationMode) : Solution [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(101,9): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(160,44): error FS0041: A unique overload for method 'GetDocument' could not be determined based on type information prior to this program point. A type annotation may be needed.Known type of argument: 'aCandidates: - Solution.GetDocument(documentId: DocumentId) : Document - Solution.GetDocument(syntaxTree: SyntaxTree) : Document [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(161,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(191,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(192,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(193,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\InlineRename\InlineRenameService.fs(208,25): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(76,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(77,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\DocumentHighlights\DocumentHighlightsService.fs(78,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(380,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(381,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(383,48): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(384,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(804,27): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(806,13): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,16): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(808,63): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\GoToDefinition.fs(809,23): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(94,30): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Navigation\FindUsagesService.fs(93,13): error FS0193: Type constraint mismatch. The type  'Async2Implementation.Async2Code' is not compatible with type 'Async2Implementation.Async2Code' [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(88,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(89,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\QuickInfo\QuickInfoProvider.fs(90,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Structure\BlockStructureService.fs(176,16): error FS0039: The value, namespace, type or module 'CancellableTask' is not defined. Maybe you want one of the following: cancellationToken [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(29,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(30,28): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(31,24): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(34,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(37,31): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,97): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(42,119): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(58,37): error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(84,73): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(117,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Commands\HelpContextService.fs(124,21): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(68,26): error FS0041: No overloads match for method 'Create'.Known types of arguments: System.String * Async2 * System.StringAvailable overloads: - CodeAction.Create(title: string, createChangedDocument: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedDocument: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedDocument' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func,System.Threading.CancellationToken,System.Threading.Tasks.Task>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, ?equivalenceKey: string, ?priority: CodeActionPriority) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, createChangedSolution: System.Func>, equivalenceKey: string) : CodeAction // Argument 'createChangedSolution' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool) : CodeAction // Argument 'nestedActions' doesn't match - CodeAction.Create(title: string, nestedActions: System.Collections.Immutable.ImmutableArray, isInlinable: bool, ?priority: CodeActionPriority) : CodeAction // Argument 'nestedActions' doesn't match [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(83,32): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(84,35): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Refactor\AddReturnType.fs(85,52): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(82,57): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\CodeFixHelpers.fs(172,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\ImplementInterface.fs(260,33): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(54,92): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\CodeFixes\RenameParamToMatchSignature.fs(57,66): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(38,49): error FS0003: This value is not a function and cannot be applied. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] -E:\repos\fsharp\vsintegration\src\FSharp.Editor\Hints\FSharpInlineHintsService.fs(42,40): error FS0039: The type 'Unit' does not define the field, constructor or member 'ToImmutableArray'. [E:\repos\fsharp\vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj] - 0 Warning(s) - 88 Error(s) - -Time Elapsed 00:00:08.35 diff --git a/vsintegration/tests/FSharp.Editor.Tests/Refactors/RefactorTestFramework.fs b/vsintegration/tests/FSharp.Editor.Tests/Refactors/RefactorTestFramework.fs index 849da8c84ec..4fc7020ddcc 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Refactors/RefactorTestFramework.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Refactors/RefactorTestFramework.fs @@ -6,12 +6,12 @@ open System.Collections.Generic open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Text -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks open FSharp.Editor.Tests.Helpers open Microsoft.CodeAnalysis.CodeRefactorings open Microsoft.CodeAnalysis.CodeActions open System.Threading +open Internal.Utilities.Library let GetTaskResult (task: Tasks.Task<'T>) = task.GetAwaiter().GetResult() @@ -39,7 +39,7 @@ type TestContext(Solution: Solution) = new TestContext(solution) let tryRefactor (code: string) (cursorPosition) (context: TestContext) (refactorProvider: 'T :> CodeRefactoringProvider) = - cancellableTask { + async2 { let mutable action: CodeAction = null let existingDocument = RoslynTestHelpers.GetLastDocument context.Solution @@ -66,11 +66,11 @@ let tryRefactor (code: string) (cursorPosition) (context: TestContext) (refactor return newDocument } - |> CancellableTask.startWithoutCancellation + |> Async2.startAsTaskWithoutCancellation |> GetTaskResult let tryGetRefactoringActions (code: string) (cursorPosition) (context: TestContext) (refactorProvider: 'T :> CodeRefactoringProvider) = - cancellableTask { + async2 { let refactoringActions = new List() let existingDocument = RoslynTestHelpers.GetLastDocument context.Solution @@ -85,5 +85,5 @@ let tryGetRefactoringActions (code: string) (cursorPosition) (context: TestConte return refactoringActions } - |> CancellableTask.startWithoutCancellation + |> Async2.startAsTaskWithoutCancellation |> fun task -> task.Result diff --git a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs index 44573a981c0..f088f414b4d 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs @@ -11,7 +11,6 @@ open Microsoft.CodeAnalysis.Text open FSharp.Editor.Tests.Helpers open Microsoft.CodeAnalysis open Microsoft.IO -open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks open FSharp.Test open Internal.Utilities.Library @@ -28,8 +27,7 @@ module SignatureHelpProvider = let filePath = "C:\\test.fs" let GetSignatureHelp (project: FSharpProject) (fileName: string) (caretPosition: int) = - async { - let! ct = Async.CancellationToken + async2 { let triggerChar = None let fileContents = File.ReadAllText(fileName) let sourceText = SourceText.From(fileContents) @@ -41,14 +39,13 @@ module SignatureHelpProvider = RoslynTestHelpers.CreateSolution(fileContents, options = project.Options) |> RoslynTestHelpers.GetSingleDocument - let parseResults, checkFileResults = + let! parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("GetSignatureHelp") - |> Async2.run ct let paramInfoLocations = parseResults.FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn).Value - let triggered = + let! triggered = FSharpSignatureHelpProvider.ProvideMethodsAsyncAux( caretLinePos, caretLineColumn, @@ -60,14 +57,12 @@ module SignatureHelpProvider = triggerChar, EditorOptions() ) - |> Async2.RunSynchronously return triggered } - |> Async.RunSynchronously let GetCompletionTypeNames (project: FSharpProject) (fileName: string) (caretPosition: int) = - let sigHelp = GetSignatureHelp project fileName caretPosition + let sigHelp = GetSignatureHelp project fileName caretPosition |> Async2.RunImmediate match sigHelp with | None -> [||] From e2cc0747bc2cfd60192af377f27a0f7dbfe0fd61 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:44:30 +0100 Subject: [PATCH 27/43] PostAndAsyncReply --- src/Compiler/Utilities/Async2.fs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 91483dc36da..3d1b767bf6e 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -618,6 +618,11 @@ type Async2 = handle.Unregister null |> ignore } +/// A reply channel for PostAndAsyncReply, analogous to AsyncReplyChannel from FSharp.Core. +[] +type AsyncReplyChannel2<'Reply>(tcs: TaskCompletionSource<'Reply>) = + member _.Reply(value: 'Reply) = tcs.TrySetResult(value) |> ignore + /// An async2-native message processing agent, analogous to MailboxProcessor but using Async2. [] type MailboxProcessor2<'Msg> private (body: MailboxProcessor2<'Msg> -> Async2, cts: CancellationTokenSource) = @@ -642,6 +647,26 @@ type MailboxProcessor2<'Msg> private (body: MailboxProcessor2<'Msg> -> Async2 return failwith "MailboxProcessor2: queue unexpectedly empty after semaphore signal" } + /// Post a message to the agent and await a reply on the channel, asynchronously. + member this.PostAndAsyncReply(buildMessage: AsyncReplyChannel2<'Reply> -> 'Msg, ?timeout: int) : Async2<'Reply> = + async2 { + let tcs = + TaskCompletionSource<'Reply>(TaskCreationOptions.RunContinuationsAsynchronously) + + let msg = buildMessage (AsyncReplyChannel2(tcs)) + this.Post msg + + match timeout with + | None + | Some -1 -> return! tcs.Task + | Some t -> + let! ct = Async2.CancellationToken + use cts = CancellationTokenSource.CreateLinkedTokenSource(ct) + cts.CancelAfter(t) + use _ = cts.Token.Register(fun () -> tcs.TrySetCanceled() |> ignore) + return! tcs.Task + } + [] member _.Error = errorEvent.Publish From d866a334632595d7754e9c8912218ac820140c66 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:44:53 +0100 Subject: [PATCH 28/43] more --- .../src/FSharp.Editor/Common/RoslynHelpers.fs | 5 ++-- .../FSharpProjectOptionsManager.fs | 26 +++++++------------ .../LanguageService/LanguageService.fs | 4 +-- .../LanguageService/WorkspaceExtensions.fs | 3 ++- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs index 1567b8c4ca1..7764b7e4a30 100644 --- a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs +++ b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs @@ -16,6 +16,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Text.Range open Microsoft.VisualStudio.FSharp.Editor.DebugHelpers open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics +open Internal.Utilities.Library type RoslynTaggedText = Microsoft.CodeAnalysis.TaggedText @@ -149,7 +150,7 @@ module internal RoslynHelpers = let StartAsyncSafe cancellationToken context computation = let computation = - async { + async2 { try return! computation with e -> @@ -157,7 +158,7 @@ module internal RoslynHelpers = return Unchecked.defaultof<_> } - Async.Start(computation, cancellationToken) + Async2.Start(computation, cancellationToken) module internal OpenDeclarationHelper = /// diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index bf27e17e80e..66febde8024 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -105,10 +105,10 @@ module private FSharpProjectOptionsHelpers = type private FSharpProjectOptionsMessage = | TryGetOptionsByDocument of Document * - AsyncReplyChannel<(FSharpParsingOptions * FSharpProjectOptions) voption> * + AsyncReplyChannel2<(FSharpParsingOptions * FSharpProjectOptions) voption> * CancellationToken * userOpName: string - | TryGetOptionsByProject of Project * AsyncReplyChannel<(FSharpParsingOptions * FSharpProjectOptions) voption> * CancellationToken + | TryGetOptionsByProject of Project * AsyncReplyChannel2<(FSharpParsingOptions * FSharpProjectOptions) voption> * CancellationToken | ClearOptions of ProjectId | ClearSingleFileOptionsCache of DocumentId @@ -267,13 +267,11 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions(projectOptions) let updateProjectOptions () = - async { + async2 { let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret - - checker.NotifyFileChanged(document.FilePath, scriptProjectOptions) - |> Async.Start + do! checker.NotifyFileChanged(document.FilePath, scriptProjectOptions) } - |> Async.Start + |> Async2.Start let onChangeCaretHandler (_, _newline: int, _oldline: int) = updateProjectOptions () let onKillFocus (_) = updateProjectOptions () @@ -439,8 +437,8 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = return ValueSome(parsingOptions, projectOptions) } - let loop (agent: MailboxProcessor) = - async { + let loop (agent: MailboxProcessor2) = + async2 { while true do match! agent.Receive() with | FSharpProjectOptionsMessage.TryGetOptionsByDocument(document, reply, ct, userOpName) -> @@ -452,11 +450,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = if document.Project.Solution.Workspace.Kind = WorkspaceKind.MiscellaneousFiles then reply.Reply ValueNone elif document.Project.IsFSharpMiscellaneousOrMetadata then - let! options = - tryComputeOptionsBySingleScriptOrFile document userOpName - |> Async2.startInThreadPool ct - |> Async.AwaitTask - + let! options = tryComputeOptionsBySingleScriptOrFile document userOpName if ct.IsCancellationRequested then reply.Reply ValueNone else @@ -468,7 +462,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = document.Project.Solution.Workspace.CurrentSolution.GetProject(document.Project.Id) if not (isNull project) then - let! options = tryComputeOptions project |> Async2.startInThreadPool ct |> Async.AwaitTask + let! options = tryComputeOptions project if ct.IsCancellationRequested then reply.Reply ValueNone @@ -524,7 +518,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = } let agent = - MailboxProcessor.Start((fun agent -> loop agent), cancellationToken = cancellationTokenSource.Token) + MailboxProcessor2.Start((fun agent -> loop agent), cancellationToken = cancellationTokenSource.Token) member _.TryGetOptionsByProjectAsync(project, ct) = agent.PostAndAsyncReply(fun reply -> FSharpProjectOptionsMessage.TryGetOptionsByProject(project, reply, ct)) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index c358fb0bbeb..3b04913024a 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -80,7 +80,7 @@ type internal FSharpWorkspaceServiceFactory None let getSource (workspace: Workspace) filename = - async { + async2 { let! ct = Async.CancellationToken match workspace.CurrentSolution.TryGetDocumentFromPath filename with @@ -168,7 +168,7 @@ type internal FSharpWorkspaceServiceFactory (if enableLiveBuffers then (DocumentSource.Custom(fun filename -> async { - match! getSource filename with + match! getSource filename |> Async2.toAsync with | Some source -> return Some(source :> ISourceText) | None -> return None })) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index e809ee8ede7..cc24b68b10c 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -310,7 +310,7 @@ module private CheckerExtensions = |> Map let getFileSnapshot (options: FSharpProjectOptions) path = - async { + async2 { let project = projects.TryFind options.ProjectFileName if project.IsNone then @@ -351,6 +351,7 @@ module private CheckerExtensions = return FSharpFileSnapshot(FileName = path, Version = version, GetSource = getSource) } + |> Async2.toAsync let! snapshot = FSharpProjectSnapshot.FromOptions(options, getFileSnapshot, ?snapshotAccumulator = snapshotAccumulatorOpt) From 21144126c8320ff878f03c49c2cbb62f274e034f Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:00:05 +0100 Subject: [PATCH 29/43] remove builder@ capture --- src/Compiler/Optimize/LowerStateMachines.fs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 2c5dea5ff07..c8b67d7161b 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -102,15 +102,8 @@ let RepresentBindingAsStateVar g (bind: Binding) (resBody: StateMachineConversio let isExpandVar g (v: Val) = isReturnsResumableCodeTy g v.TauType -// We allow a prefix of bindings prior to the state machine, e.g. -// task { .. } -// becomes -// let builder@ = task -// .... let isStateMachineBindingVar g (v: Val) = - isExpandVar g v || - (let nm = v.LogicalName - (nm.StartsWithOrdinal("builder@") || v.IsMemberThisVal)) + isExpandVar g v || v.IsMemberThisVal type env = { From 46f0d30a1c4d28d136d57deb20e209d196c9390c Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:00:31 +0100 Subject: [PATCH 30/43] fix affected tests --- .../BuildGraphTests.fs | 6 +- ...iler.Service.SurfaceArea.netstandard20.bsl | 3 + .../CodeGen/EmittedIL/TaskGeneratedCode.fs | 533 +++++++++--------- 3 files changed, 272 insertions(+), 270 deletions(-) diff --git a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs index 6a454ae721d..b8023e717aa 100644 --- a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs @@ -218,7 +218,7 @@ module BuildGraphTests = cts.Cancel() resetEvent.Set() |> ignore - Async2.RunImmediate(work) + Async2.RunSynchronously(work) |> ignore Assert.shouldBeTrue cts.IsCancellationRequested @@ -365,12 +365,12 @@ module BuildGraphTests = let logger = DiagnosticsLoggerWithCallback errorCommitted use _ = UseDiagnosticsLogger logger - tasks |> Seq.take 50 |> MultipleDiagnosticsLoggers.Parallel |> Async2.Ignore |> Async2.RunImmediate + tasks |> Seq.take 50 |> MultipleDiagnosticsLoggers.Parallel |> Async2.Ignore |> Async2.RunSynchronously // all errors committed errorCountShouldBe 300 - tasks |> Seq.skip 50 |> MultipleDiagnosticsLoggers.Sequential |> Async2.Ignore |> Async2.RunImmediate + tasks |> Seq.skip 50 |> MultipleDiagnosticsLoggers.Sequential |> Async2.Ignore |> Async2.RunSynchronously errorCountShouldBe 600 diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index c88b48c5960..12e0003956d 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -12631,6 +12631,8 @@ Internal.Utilities.Library.Async2Module: t run[t](System.Threading.CancellationT Internal.Utilities.Library.Async2`1[t]: Internal.Utilities.Library.IAsync2Invocation`1[t] Await(System.Threading.CancellationToken) Internal.Utilities.Library.Async2`1[t]: Internal.Utilities.Library.IAsync2Invocation`1[t] Start(System.Threading.CancellationToken) Internal.Utilities.Library.Async2`1[t]: Void TailCall(System.Threading.CancellationToken, System.Threading.Tasks.TaskCompletionSource`1[t]) +Internal.Utilities.Library.AsyncReplyChannel2`1[Reply]: Void .ctor(System.Threading.Tasks.TaskCompletionSource`1[Reply]) +Internal.Utilities.Library.AsyncReplyChannel2`1[Reply]: Void Reply(Reply) Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: System.Collections.Generic.IDictionary`2[TDictKey,TDictValue] CreateDictionary(T[]) Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: System.Collections.Generic.IDictionary`2[TDictKey,TDictValue] GetDictionary() Internal.Utilities.Library.DelayInitArrayMap`3[T,TDictKey,TDictValue]: T[] GetArray() @@ -12656,6 +12658,7 @@ Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.R Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind$W[a,b,c,d,e](Microsoft.FSharp.Core.FSharpFunc`2[a,b], Microsoft.FSharp.Core.FSharpFunc`2[b,c], Microsoft.FSharp.Core.FSharpFunc`2[b,System.Boolean], Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) Internal.Utilities.Library.LowPriority: Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e] Async2Builder.Bind[a,b,c,d,e](Async2Builder, a, Microsoft.FSharp.Core.FSharpFunc`2[c,Microsoft.FSharp.Core.CompilerServices.ResumableCode`2[Internal.Utilities.Library.Async2Implementation+Async2Data`1[d],e]]) Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Internal.Utilities.Library.Async2`1[Msg] Receive() +Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Internal.Utilities.Library.Async2`1[Reply] PostAndAsyncReply[Reply](Microsoft.FSharp.Core.FSharpFunc`2[Internal.Utilities.Library.AsyncReplyChannel2`1[Reply],Msg], Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Internal.Utilities.Library.MailboxProcessor2`1[Msg] Start(Microsoft.FSharp.Core.FSharpFunc`2[Internal.Utilities.Library.MailboxProcessor2`1[Msg],Internal.Utilities.Library.Async2`1[Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Microsoft.FSharp.Control.FSharpHandler`1[System.Exception] Error Internal.Utilities.Library.MailboxProcessor2`1[Msg]: Void Dispose() diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs index 04c97034dbf..c77b58ef8a4 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs @@ -1101,288 +1101,287 @@ type Generic1InGeneric1<'T>() = (fun verifier -> verifier.VerifyIL [ """ .class public abstract auto ansi sealed Test - extends [runtime]System.Object + extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) .class auto ansi serializable nested public beforefieldinit Generic1InGeneric1`1 - extends [runtime]System.Object + extends [runtime]System.Object { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .class auto autochar sealed nested assembly beforefieldinit specialname clo@7 - extends [runtime]System.ValueType - implements [runtime]System.Runtime.CompilerServices.IAsyncStateMachine, - class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1> - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .field public valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Data - .field public int32 ResumptionPoint - .field public class [runtime]System.Threading.Tasks.Task`1 computation - .field public valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 awaiter - .method public strict virtual instance void MoveNext() cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 5 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - class [runtime]System.Threading.Tasks.Task`1 V_3, - bool V_4, - bool V_5, - !A V_6, - !A V_7, - valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_8, - class [runtime]System.Exception V_9, - class [runtime]System.Exception V_10) - IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldc.i4.1 - IL_0009: sub - IL_000a: switch ( - IL_0015) - IL_0013: br.s IL_0018 - - IL_0015: nop - IL_0016: br.s IL_001d - - IL_0018: nop - IL_0019: br.s IL_001b - - IL_001b: ldnull - IL_001c: stloc.1 - .try - { - IL_001d: ldloc.0 - IL_001e: ldc.i4.1 - IL_001f: sub - IL_0020: switch ( - IL_002b) - IL_0029: br.s IL_002e - - IL_002b: nop - IL_002c: br.s IL_0059 - - IL_002e: nop - IL_002f: br.s IL_0031 - - IL_0031: ldarg.0 - IL_0032: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation - IL_0037: stloc.3 - IL_0038: ldarg.0 - IL_0039: ldloc.3 - IL_003a: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() - IL_003f: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_0044: ldc.i4.1 - IL_0045: stloc.s V_4 - IL_0047: ldarg.0 - IL_0048: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_004d: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() - IL_0052: brfalse.s IL_0056 - - IL_0054: br.s IL_006f - - IL_0056: ldc.i4.0 - IL_0057: brfalse.s IL_005d - - IL_0059: ldc.i4.1 - IL_005a: nop - IL_005b: br.s IL_0066 - - IL_005d: ldarg.0 - IL_005e: ldc.i4.1 - IL_005f: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0064: ldc.i4.0 - IL_0065: nop - IL_0066: stloc.s V_5 - IL_0068: ldloc.s V_5 - IL_006a: stloc.s V_4 - IL_006c: nop - IL_006d: br.s IL_0070 - - IL_006f: nop - IL_0070: ldloc.s V_4 - IL_0072: brfalse.s IL_0096 - - IL_0074: ldarg.0 - IL_0075: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_007a: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() - IL_007f: stloc.s V_6 - IL_0081: ldloc.s V_6 - IL_0083: stloc.s V_7 - IL_0085: ldarg.0 - IL_0086: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_008b: ldloc.s V_7 - IL_008d: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0092: ldc.i4.1 - IL_0093: nop - IL_0094: br.s IL_00af - - IL_0096: ldarg.0 - IL_0097: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_009c: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00a1: ldarg.0 - IL_00a2: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_00a7: ldarg.0 - IL_00a8: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, - !!1&) - IL_00ad: ldc.i4.0 - IL_00ae: nop - IL_00af: brfalse.s IL_00c5 - - IL_00b1: ldarg.0 - IL_00b2: ldloca.s V_8 - IL_00b4: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 - IL_00ba: ldloc.s V_8 - IL_00bc: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_00c1: ldc.i4.1 - IL_00c2: nop - IL_00c3: br.s IL_00c7 - - IL_00c5: ldc.i4.0 - IL_00c6: nop - IL_00c7: stloc.2 - IL_00c8: ldloc.2 - IL_00c9: brfalse.s IL_00e8 - - IL_00cb: ldarg.0 - IL_00cc: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_00d1: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00d6: ldarg.0 - IL_00d7: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_00dc: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_00e1: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_00e6: leave.s IL_00f6 - - IL_00e8: leave.s IL_00f6 +.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) +.class auto autochar sealed nested assembly beforefieldinit specialname clo@7 + extends [runtime]System.ValueType + implements [runtime]System.Runtime.CompilerServices.IAsyncStateMachine, + class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1> +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .field public valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Data + .field public int32 ResumptionPoint + .field public class [runtime]System.Threading.Tasks.Task`1 computation + .field public valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 awaiter + .method public strict virtual instance void MoveNext() cil managed + { + .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext + + .maxstack 5 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + bool V_2, + class [runtime]System.Threading.Tasks.Task`1 V_3, + bool V_4, + bool V_5, + !A V_6, + !A V_7, + valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_8, + class [runtime]System.Exception V_9, + class [runtime]System.Exception V_10) + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: sub + IL_000a: switch ( + IL_0015) + IL_0013: br.s IL_0018 - } - catch [runtime]System.Object - { - IL_00ea: castclass [runtime]System.Exception - IL_00ef: stloc.s V_9 - IL_00f1: ldloc.s V_9 - IL_00f3: stloc.1 - IL_00f4: leave.s IL_00f6 + IL_0015: nop + IL_0016: br.s IL_001d - } - IL_00f6: ldloc.1 - IL_00f7: stloc.s V_10 - IL_00f9: ldloc.s V_10 - IL_00fb: brtrue.s IL_00fe - - IL_00fd: ret - - IL_00fe: ldarg.0 - IL_00ff: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0104: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0109: ldloc.s V_10 - IL_010b: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0110: ret - } - - .method public strict virtual instance void SetStateMachine(class [runtime]System.Runtime.CompilerServices.IAsyncStateMachine state) cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0006: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_000b: ldarg.1 - IL_000c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetStateMachine(class [netstandard]System.Runtime.CompilerServices.IAsyncStateMachine) - IL_0011: ret - } - - .method public strict virtual instance int32 get_ResumptionPoint() cil managed - { - .override method instance int32 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_ResumptionPoint() - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0006: ret - } + IL_0018: nop + IL_0019: br.s IL_001b - .method public strict virtual instance valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 get_Data() cil managed - { - .override method instance !0 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_Data() - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0006: ret - } + IL_001b: ldnull + IL_001c: stloc.1 + .try + { + IL_001d: ldloc.0 + IL_001e: ldc.i4.1 + IL_001f: sub + IL_0020: switch ( + IL_002b) + IL_0029: br.s IL_002e + + IL_002b: nop + IL_002c: br.s IL_0059 + + IL_002e: nop + IL_002f: br.s IL_0031 + + IL_0031: ldarg.0 + IL_0032: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation + IL_0037: stloc.3 + IL_0038: ldarg.0 + IL_0039: ldloc.3 + IL_003a: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() + IL_003f: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0044: ldc.i4.1 + IL_0045: stloc.s V_4 + IL_0047: ldarg.0 + IL_0048: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_004d: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() + IL_0052: brfalse.s IL_0056 + + IL_0054: br.s IL_006f + + IL_0056: ldc.i4.0 + IL_0057: brfalse.s IL_005d + + IL_0059: ldc.i4.1 + IL_005a: nop + IL_005b: br.s IL_0066 + + IL_005d: ldarg.0 + IL_005e: ldc.i4.1 + IL_005f: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0064: ldc.i4.0 + IL_0065: nop + IL_0066: stloc.s V_5 + IL_0068: ldloc.s V_5 + IL_006a: stloc.s V_4 + IL_006c: nop + IL_006d: br.s IL_0070 + + IL_006f: nop + IL_0070: ldloc.s V_4 + IL_0072: brfalse.s IL_0096 + + IL_0074: ldarg.0 + IL_0075: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_007a: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() + IL_007f: stloc.s V_6 + IL_0081: ldloc.s V_6 + IL_0083: stloc.s V_7 + IL_0085: ldarg.0 + IL_0086: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_008b: ldloc.s V_7 + IL_008d: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result + IL_0092: ldc.i4.1 + IL_0093: nop + IL_0094: br.s IL_00af + + IL_0096: ldarg.0 + IL_0097: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_009c: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_00a1: ldarg.0 + IL_00a2: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_00a7: ldarg.0 + IL_00a8: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, + !!1&) + IL_00ad: ldc.i4.0 + IL_00ae: nop + IL_00af: brfalse.s IL_00c5 + + IL_00b1: ldarg.0 + IL_00b2: ldloca.s V_8 + IL_00b4: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 + IL_00ba: ldloc.s V_8 + IL_00bc: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_00c1: ldc.i4.1 + IL_00c2: nop + IL_00c3: br.s IL_00c7 + + IL_00c5: ldc.i4.0 + IL_00c6: nop + IL_00c7: stloc.2 + IL_00c8: ldloc.2 + IL_00c9: brfalse.s IL_00e8 + + IL_00cb: ldarg.0 + IL_00cc: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00d1: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_00d6: ldarg.0 + IL_00d7: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00dc: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result + IL_00e1: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) + IL_00e6: leave.s IL_00f6 + + IL_00e8: leave.s IL_00f6 - .method public strict virtual instance void set_Data(valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 'value') cil managed - { - .override method instance void class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::set_Data(!0) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0007: ret - } + } + catch [runtime]System.Object + { + IL_00ea: castclass [runtime]System.Exception + IL_00ef: stloc.s V_9 + IL_00f1: ldloc.s V_9 + IL_00f3: stloc.1 + IL_00f4: leave.s IL_00f6 - } + } + IL_00f6: ldloc.1 + IL_00f7: stloc.s V_10 + IL_00f9: ldloc.s V_10 + IL_00fb: brtrue.s IL_00fe + + IL_00fd: ret + + IL_00fe: ldarg.0 + IL_00ff: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0104: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_0109: ldloc.s V_10 + IL_010b: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) + IL_0110: ret + } - .method public specialname rtspecialname instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ret - } + .method public strict virtual instance void SetStateMachine(class [runtime]System.Runtime.CompilerServices.IAsyncStateMachine state) cil managed + { + .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0006: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_000b: ldarg.1 + IL_000c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetStateMachine(class [netstandard]System.Runtime.CompilerServices.IAsyncStateMachine) + IL_0011: ret + } - .method public hidebysig instance class [runtime]System.Threading.Tasks.Task`1 Run() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.3 - IL_0002: call class [runtime]System.Threading.Tasks.Task`1 [runtime]System.Threading.Tasks.Task::FromResult(!!0) - IL_0007: callvirt instance class [runtime]System.Threading.Tasks.Task`1 class Test/Generic1InGeneric1`1::run(class [runtime]System.Threading.Tasks.Task`1) - IL_000c: ret - } + .method public strict virtual instance int32 get_ResumptionPoint() cil managed + { + .override method instance int32 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_ResumptionPoint() + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0006: ret + } - .method assembly hidebysig instance class [runtime]System.Threading.Tasks.Task`1 run(class [runtime]System.Threading.Tasks.Task`1 computation) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals init (valuetype Test/Generic1InGeneric1`1/clo@7 V_0, - valuetype Test/Generic1InGeneric1`1/clo@7& V_1) - IL_0000: ldloca.s V_0 - IL_0002: initobj valuetype Test/Generic1InGeneric1`1/clo@7 - IL_0008: ldloca.s V_0 - IL_000a: stloc.1 - IL_000b: ldloc.1 - IL_000c: ldarg.1 - IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation - IL_0012: ldloc.1 - IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0018: call valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() - IL_001d: stfld valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0022: ldloc.1 - IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0028: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_002d: ldloc.1 - IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) - IL_0033: ldloc.1 - IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0039: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_003e: call instance class [netstandard]System.Threading.Tasks.Task`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::get_Task() - IL_0043: ret - } + .method public strict virtual instance valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 get_Data() cil managed + { + .override method instance !0 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_Data() + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0006: ret + } + .method public strict virtual instance void set_Data(valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 'value') cil managed + { + .override method instance void class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::set_Data(!0) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0007: ret } +} + +.method public specialname rtspecialname instance void .ctor() cil managed +{ + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret +} + +.method public hidebysig instance class [runtime]System.Threading.Tasks.Task`1 Run() cil managed +{ + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.3 + IL_0002: call class [runtime]System.Threading.Tasks.Task`1 [runtime]System.Threading.Tasks.Task::FromResult(!!0) + IL_0007: callvirt instance class [runtime]System.Threading.Tasks.Task`1 class Test/Generic1InGeneric1`1::run(class [runtime]System.Threading.Tasks.Task`1) + IL_000c: ret +} + +.method assembly hidebysig instance class [runtime]System.Threading.Tasks.Task`1 run(class [runtime]System.Threading.Tasks.Task`1 computation) cil managed +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0, + valuetype Test/Generic1InGeneric1`1/clo@7 V_1, + valuetype Test/Generic1InGeneric1`1/clo@7& V_2) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloca.s V_1 + IL_0008: initobj valuetype Test/Generic1InGeneric1`1/clo@7 + IL_000e: ldloca.s V_1 + IL_0010: stloc.2 + IL_0011: ldloc.2 + IL_0012: ldarg.1 + IL_0013: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation + IL_0018: ldloc.2 + IL_0019: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_001e: call valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() + IL_0023: stfld valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_0028: ldloc.2 + IL_0029: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_002e: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_0033: ldloc.2 + IL_0034: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) + IL_0039: ldloc.2 + IL_003a: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_003f: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_0044: call instance class [netstandard]System.Threading.Tasks.Task`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::get_Task() + IL_0049: ret } """ ])) From f639e6bdc8808f1325b2b5dcddc3121f0dfa29a4 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:00:45 +0100 Subject: [PATCH 31/43] bootstrapUseRepoCompiler --- eng/Build.ps1 | 3 +++ eng/build-utils.ps1 | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 40c32755968..73d92afc3d4 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -34,6 +34,7 @@ param ( # Options [switch][Alias('proto')]$bootstrap, + [switch]$bootstrapUseRepoCompiler, [string]$bootstrapConfiguration = "Proto", [string]$bootstrapTfm = "", [string]$fsharpNetCoreProductTfm = "", @@ -529,6 +530,8 @@ try { Process-Arguments + # expose the new flag to helper scripts + $script:bootstrapUseRepoCompiler = $bootstrapUseRepoCompiler . (Join-Path $PSScriptRoot "build-utils.ps1") diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index e40cf36fd9f..18886493dfe 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -250,6 +250,33 @@ function Make-BootstrapBuild() { $logFilePath = Join-Path $LogDir "bootstrap.binlog" $args += " /bl:`"$logFilePath`"" } + # Use explicit repo-built fsc.dll location. No guesses. + if ($script:bootstrapUseRepoCompiler) { + Write-Host "Configuring bootstrap to use compiler built in repo (explicit)" + try { + # PSScriptRoot is eng; go up one level to reach repo root + $repoRootPath = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path + } + catch { + if ($RepoRoot -is [System.Management.Automation.PathInfo]) { $repoRootPath = $RepoRoot.Path } + elseif ($RepoRoot -is [System.Array]) { $first = $RepoRoot[0]; if ($first -is [System.Management.Automation.PathInfo]) { $repoRootPath = $first.Path } else { $repoRootPath = $first.ToString() } } + else { $repoRootPath = $RepoRoot.ToString() } + } + + $explicitFsc = [System.IO.Path]::Combine($repoRootPath, 'artifacts','bin','fsc',$configuration,$bootstrapTfm,'fsc.dll') + + if (-not (Test-Path $explicitFsc)) { + Write-Host "Error: expected repo-built compiler not found: $explicitFsc" + Write-Host "Proceeding without DotnetFscCompilerPath" + } + else { + # Pass the DLL path directly as the MSBuild property, as requested by user + $args += " /p:DotnetFscCompilerPath=`"$explicitFsc`"" + Write-Host "Set DotnetFscCompilerPath=$explicitFsc" + # Prevent MSBuild SDK redirection to its internal compiler + $args += " /p:DisableCompilerRedirection=true" + } + } Write-Host "$dotnetExe $args" Exec-Console $dotnetExe $args return $dir From 0c4166fd0e411f1fa104b639df9fe442829106bb Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:46:35 +0200 Subject: [PATCH 32/43] add test --- .../Language/StateMachineTests.fs | 85 +++++++++++++------ 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index e32817f799d..36c49541af6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -6,15 +6,32 @@ open Xunit open FSharp.Test.Assert open FSharp.Test.Compiler +module StateMachineTests = -// Inlined helper containing a "if __useResumableCode ..." construct failed to expand correctly, -// executing the dynmamic branch at runtime even when the state machine was compiled statically. -// see https://github.com/dotnet/fsharp/issues/19296 -module FailingInlinedHelper = - open FSharp.Core.CompilerServices - open FSharp.Core.CompilerServices.StateMachineHelpers - open System.Runtime.CompilerServices + let verify3511AndRun code = + Fsx code + |> withNoOptimize + |> compile + |> shouldFail + |> withWarningCode 3511 + |> ignore + + Fsx code + |> withNoOptimize + |> withOptions ["--nowarn:3511"] + |> compileExeAndRun + // Inlined helper containing a "if __useResumableCode ..." construct failed to expand correctly, + // executing the dynmamic branch at runtime even when the state machine was compiled statically. + // see https://github.com/dotnet/fsharp/issues/19296 + [] + let ``Nested __useResumableCode is expanded correctly`` () = + Fsx """ +open FSharp.Core.CompilerServices +open FSharp.Core.CompilerServices.StateMachineHelpers +open System.Runtime.CompilerServices + +module FailingInlinedHelper = let inline MoveOnce(x: byref<'T> when 'T :> IAsyncStateMachine and 'T :> IResumableStateMachine<'Data>) = x.MoveNext() x.Data @@ -27,7 +44,7 @@ module FailingInlinedHelper = else failwith "unexpected dynamic branch at runtime") - #nowarn 3513 // Resumable code invocation. + #nowarn 3513 let inline repro x = if __useResumableCode then __stateMachine @@ -38,25 +55,10 @@ module FailingInlinedHelper = failwith "dynamic state machine" #warnon 3513 -module StateMachineTests = - - let verify3511AndRun code = - Fsx code - |> withNoOptimize - |> compile - |> shouldFail - |> withWarningCode 3511 - |> ignore - - Fsx code - |> withNoOptimize - |> withOptions ["--nowarn:3511"] +if FailingInlinedHelper.repro 42 <> 42 then failwith "unexpected result" +""" |> compileExeAndRun - - [] - let ``Nested __useResumableCode is expanded correctly`` () = - FailingInlinedHelper.repro 42 - |> shouldEqual 42 + |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/13067 let ``Local function with a flexible type``() = @@ -467,3 +469,34 @@ if result[0].x <> 1 then failwith $"unexpected result {result[0]}" |> asExe |> compileExeAndRun |> shouldSucceed + + [] + let ``Debug-mode: mixing resumable and standard computation expressions compiles``() = + FSharp """ +module ReproMixedBuilders +open System.Threading.Tasks + +type TaskMaybeBuilder() = + + member inline _.Zero() = Task.FromResult None + + member inline _.Delay([] f) = task { return! f () } + + member inline _.Bind(value, [] f) = + task { + match value with + | None -> return None + | Some result -> return! f result + } + +let taskMaybe = TaskMaybeBuilder() + +let trigger() = + taskMaybe { + do! None + } +""" + |> withDebug + |> withNoOptimize + |> compile + |> shouldSucceed \ No newline at end of file From ae97a95f841a1e77c906eeeef9094e087f8cff7a Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 22 Apr 2026 14:49:53 +0200 Subject: [PATCH 33/43] revert and try another fix for nested __useResumableCode --- src/Compiler/Optimize/LowerStateMachines.fs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 2c5dea5ff07..a55e5916b04 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -338,6 +338,9 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = if sm_verbose then printfn "expanding defns and reducing %A..." expr //if sm_verbose then printfn "checking %A for possible resumable code application..." expr match expr with + | IfUseResumableStateMachinesExpr g (thenExpr, _) when Option.isNone (IsStateMachineExpr g thenExpr) -> + Some (remake thenExpr) + // defn --> [expand_code] | Expr.Val (defnRef, _, _) when env.ResumableCodeDefns.ContainsVal defnRef.Deref -> let defn = env.ResumableCodeDefns[defnRef.Deref] @@ -372,22 +375,13 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = // Repeated top-down rewrite let makeRewriteEnv (env: env) = { PreIntercept = Some (fun cont e -> - match e with - // Don't recurse into nested state machine expressions - they will be - // processed by their own LowerStateMachineExpr during codegen. - // This prevents modification of the nested machine's internal - // 'if __useResumableCode' patterns which select its dynamic fallback. - | _ when Option.isSome (IsStateMachineExpr g e) -> Some e - // Eliminate 'if __useResumableCode' - nested state machines are already - // guarded above, so any remaining occurrences at this level are from - // beta-reduced inline helpers and should take the static branch. - | IfUseResumableStateMachinesExpr g (thenExpr, _) -> Some (cont thenExpr) - | _ -> - match TryReduceExpr env e [] id with Some e2 -> Some (cont e2) | None -> None) + match TryReduceExpr env e [] id with + | Some e2 -> Some (cont e2) + | None -> None) PostTransform = (fun _ -> None) PreInterceptBinding = None RewriteQuotations=true - StackGuard = StackGuard("LowerStateMachineStackGuardDepth") } + StackGuard = StackGuard("LowerStateMachineStackGuard") } let ConvertStateMachineLeafExpression (env: env) expr = if sm_verbose then printfn "ConvertStateMachineLeafExpression for %A..." expr From 120f77cea825c53ff295fbc0da539538be9cff6a Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:05:10 +0200 Subject: [PATCH 34/43] release notes --- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index e175f4dce0e..1fd00f48104 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -35,6 +35,7 @@ * Fix signature generation: `private` keyword placement for prefix-style type abbreviations. ([Issue #15560](https://github.com/dotnet/fsharp/issues/15560), [PR #19586](https://github.com/dotnet/fsharp/pull/19586)) * Fix signature generation: missing `[]` attribute for types without visible constructors. ([Issue #16531](https://github.com/dotnet/fsharp/issues/16531), [PR #19586](https://github.com/dotnet/fsharp/pull/19586)) * Fix methods being tagged as `Member` instead of `Method` in tooltips. ([Issue #10540](https://github.com/dotnet/fsharp/issues/10540), [PR #19507](https://github.com/dotnet/fsharp/pull/19507)) +* Fix Debug-mode compilation when mixing resumable and standard computation expressions. ([Issue #19625](https://github.com/dotnet/fsharp/issues/19625), [PR #19630](https://github.com/dotnet/fsharp/pull/19630)) ### Added From efa65475ad4166659c133394d3e6b924df7e31eb Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:08:29 +0200 Subject: [PATCH 35/43] add a comment and verbose message --- src/Compiler/Optimize/LowerStateMachines.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index a55e5916b04..cb9453d3177 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -338,7 +338,11 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = if sm_verbose then printfn "expanding defns and reducing %A..." expr //if sm_verbose then printfn "checking %A for possible resumable code application..." expr match expr with + // Reduce helper-local 'if __useResumableCode then ... else ...' after inlining, + // but preserve real nested state machines so their own lowering can still choose + // the dynamic fallback if static compilation fails. | IfUseResumableStateMachinesExpr g (thenExpr, _) when Option.isNone (IsStateMachineExpr g thenExpr) -> + if sm_verbose then printfn "reducing helper-local 'if __useResumableCode ...' to static branch" Some (remake thenExpr) // defn --> [expand_code] From c38f1ebd797c0b7ff95a531ac6d31214e3c46348 Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Sun, 16 Aug 2026 21:57:03 +0200 Subject: [PATCH 36/43] do code fixes --- .fantomasignore | 2 -- .../Classification/ClassificationService.fs | 1 - .../CodeFixes/AddMissingAttributeToSignature.fs | 6 +++--- .../RemoveExtraAttributeFromImplementation.fs | 6 +++--- .../Debugging/LanguageDebugInfoService.fs | 2 +- .../LanguageService/WorkspaceExtensions.fs | 4 ++-- .../Structure/BlockStructureService.fs | 1 - .../AddMissingAttributeToSignatureTests.fs | 10 ++++------ .../RemoveExtraAttributeFromImplementationTests.fs | 4 ++-- .../DocumentDiagnosticAnalyzerTests.fs | 14 ++++++++++---- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.fantomasignore b/.fantomasignore index 1b373a01b2e..e93d41fcc8f 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -92,8 +92,6 @@ src/Compiler/Service/IncrementalBuild.fs src/Compiler/Service/ServiceAssemblyContent.fs src/Compiler/Service/ServiceDeclarationLists.fs src/Compiler/Service/ServiceErrorResolutionHints.fs -vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs - # Fantomas limitations on signature files (to investigate) src/Compiler/AbstractIL/ilread.fsi diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs index 8dd411a4000..e7ed58ffc27 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs @@ -302,7 +302,6 @@ type internal FSharpClassificationService [] () = addSemanticClassification sourceText textSpan classificationData result } - //|> CancellableTask.ifCanceledReturn () |> Async2.startAsUnitTask cancellationToken // Do not perform classification if we don't have project options (#defines matter) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingAttributeToSignature.fs b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingAttributeToSignature.fs index feeb3b10722..e8ce4eb5c17 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingAttributeToSignature.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/AddMissingAttributeToSignature.fs @@ -13,7 +13,7 @@ open Microsoft.CodeAnalysis.Text open FSharp.Compiler.Symbols -open CancellableTasks +open Internal.Utilities.Library [] type internal AddMissingAttributeToSignatureCodeFixProvider [] () = @@ -126,7 +126,7 @@ type internal AddMissingAttributeToSignatureCodeFixProvider [ () } - |> CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveExtraAttributeFromImplementation.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveExtraAttributeFromImplementation.fs index 562b0ba74b0..9662c233dae 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveExtraAttributeFromImplementation.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveExtraAttributeFromImplementation.fs @@ -11,7 +11,7 @@ open Microsoft.CodeAnalysis.CodeActions open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.Text -open CancellableTasks +open Internal.Utilities.Library [] type internal RemoveExtraAttributeFromImplementationCodeFixProvider [] () = @@ -84,7 +84,7 @@ type internal RemoveExtraAttributeFromImplementationCodeFixProvider [ CancellableTask.startAsTask context.CancellationToken + |> Async2.startAsUnitTask context.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs index 3acda8664a4..4901d2e830b 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs @@ -52,7 +52,7 @@ type internal FSharpLanguageDebugInfoService [] () = member _.GetDataTipInfoAsync (document: Document, position: int, cancellationToken: CancellationToken) : Task = - cancellableTask { + async2 { let defines, langVersion = document.GetFsharpParsingOptions() let! cancellationToken = Async2.CancellationToken diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 0a349f6ab54..512bd9bf3ba 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -635,9 +635,9 @@ type Document with /// Try to find a F# lexer/token symbol of the given F# document and position. member this.TryFindFSharpLexerSymbolAsync(position, lookupKind, wholeActivePattern, allowStringToken, userOpName) = - cancellableTask { + async2 { let! defines, langVersion = this.GetFsharpParsingOptionsAsync(userOpName) - let! ct = CancellableTask.getCancellationToken () + let! ct = Async2.CancellationToken let! sourceText = this.GetTextAsync(ct) return diff --git a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs index 35600309a5c..d87d44b84cb 100644 --- a/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs +++ b/vsintegration/src/FSharp.Editor/Structure/BlockStructureService.fs @@ -173,5 +173,4 @@ type internal FSharpBlockStructureService [] () = |> Seq.toImmutableArray |> FSharpBlockStructure } - //|> CancellableTask.ifCanceledReturn emptyValue |> Async2.startInThreadPool cancellationToken diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddMissingAttributeToSignatureTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddMissingAttributeToSignatureTests.fs index 91cd072de59..f61cca6e704 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddMissingAttributeToSignatureTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/AddMissingAttributeToSignatureTests.fs @@ -11,6 +11,7 @@ open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor +open Internal.Utilities.Library open FSharp.Editor.Tests.Helpers open FSharp.Editor.Tests.CodeFixes.CodeFixTestFramework @@ -30,8 +31,7 @@ let private tryFixSigAt (diagIndex: int) (fsiCode: string) (fsCode: string) : st let sourceText = fsDoc.GetTextAsync().Result let _, checkResults = - fsDoc.GetFSharpParseAndCheckResultsAsync "test" - |> Microsoft.VisualStudio.FSharp.Editor.CancellableTasks.CancellableTask.runSynchronouslyWithoutCancellation + fsDoc.GetFSharpParseAndCheckResultsAsync "test" |> Async2.runWithoutCancellation let diagnostics = checkResults.Diagnostics @@ -74,8 +74,7 @@ let private countDiags (fsiCode: string) (fsCode: string) : int = let fsDoc = documents |> List.find (fun d -> not d.IsFSharpSignatureFile) let _, checkResults = - fsDoc.GetFSharpParseAndCheckResultsAsync "test" - |> Microsoft.VisualStudio.FSharp.Editor.CancellableTasks.CancellableTask.runSynchronouslyWithoutCancellation + fsDoc.GetFSharpParseAndCheckResultsAsync "test" |> Async2.runWithoutCancellation checkResults.Diagnostics |> Array.filter (fun d -> d.ErrorNumber = 3888) @@ -426,8 +425,7 @@ let inline f (x: int) = x + 1 let sourceText = fsDoc.GetTextAsync().Result let _, checkResults = - fsDoc.GetFSharpParseAndCheckResultsAsync "test" - |> Microsoft.VisualStudio.FSharp.Editor.CancellableTasks.CancellableTask.runSynchronouslyWithoutCancellation + fsDoc.GetFSharpParseAndCheckResultsAsync "test" |> Async2.runWithoutCancellation let diagnostic = checkResults.Diagnostics diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveExtraAttributeFromImplementationTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveExtraAttributeFromImplementationTests.fs index b90aee5de4a..5f0217fe774 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveExtraAttributeFromImplementationTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveExtraAttributeFromImplementationTests.fs @@ -11,6 +11,7 @@ open Microsoft.CodeAnalysis.CodeFixes open Microsoft.CodeAnalysis.Text open Microsoft.VisualStudio.FSharp.Editor +open Internal.Utilities.Library open FSharp.Editor.Tests.Helpers open FSharp.Editor.Tests.CodeFixes.CodeFixTestFramework @@ -28,8 +29,7 @@ let private tryFixFsAt (diagIndex: int) (fsiCode: string) (fsCode: string) : str let sourceText = fsDoc.GetTextAsync().Result let _, checkResults = - fsDoc.GetFSharpParseAndCheckResultsAsync "test" - |> Microsoft.VisualStudio.FSharp.Editor.CancellableTasks.CancellableTask.runSynchronouslyWithoutCancellation + fsDoc.GetFSharpParseAndCheckResultsAsync "test" |> Async2.runWithoutCancellation let diagnostics = checkResults.Diagnostics diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs index 0c9adbc858c..7c3f443792b 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs @@ -19,13 +19,19 @@ type DocumentDiagnosticAnalyzerTests() = RoslynTestHelpers.CreateSolution(fileContents, ?extraFSharpProjectOtherOptions = additionalFlags) |> RoslynTestHelpers.GetSingleDocument - let syntacticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) |> Async2.RunSynchronously - let semanticDiagnostics = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) |> Async2.RunSynchronously + let syntacticDiagnostics = + FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Syntax) + |> Async2.RunSynchronously + + let semanticDiagnostics = + FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) + |> Async2.RunSynchronously + syntacticDiagnostics.AddRange(semanticDiagnostics) member private _.getSyntaxAndSemantic(fileContents: string) = let task = - cancellableTask { + async2 { let document = RoslynTestHelpers.CreateSolution(fileContents) |> RoslynTestHelpers.GetSingleDocument @@ -34,7 +40,7 @@ type DocumentDiagnosticAnalyzerTests() = let! semantic = FSharpDocumentDiagnosticAnalyzer.GetDiagnostics(document, DiagnosticsType.Semantic) return Seq.toArray syntactic, Seq.toArray semantic } - |> CancellableTask.start CancellationToken.None + |> Async2.startAsTask CancellationToken.None task.Result From 074b01b9c7ff67882709d37f01300822d17a2871 Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Wed, 19 Aug 2026 21:58:25 +0200 Subject: [PATCH 37/43] remove unused --- src/Compiler/Facilities/AsyncMemoize.fs | 3 --- src/Compiler/Facilities/AsyncMemoize.fsi | 2 -- 2 files changed, 5 deletions(-) diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs index 0c0403cd5ef..70fb24fd25c 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fs +++ b/src/Compiler/Facilities/AsyncMemoize.fs @@ -280,9 +280,6 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue | Error exn -> return raise exn } - member this.GetAsync(key, computation: Async<_>) = - this.Get(key, async2 { return! computation }) |> Async2.toAsync - member _.TryGet(key: 'TKey, predicate: 'TVersion -> bool) : 'TValue option = lock cache <| fun () -> diff --git a/src/Compiler/Facilities/AsyncMemoize.fsi b/src/Compiler/Facilities/AsyncMemoize.fsi index 4ac4b91b81f..9d09d3ed8fc 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fsi +++ b/src/Compiler/Facilities/AsyncMemoize.fsi @@ -63,8 +63,6 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue member Get: key: ICacheKey<'TKey, 'TVersion> * computation: Async2<'TValue> -> Async2<'TValue> - member GetAsync: key: ICacheKey<'TKey, 'TVersion> * computation: Async<'TValue> -> Async<'TValue> - member TryGet: key: 'TKey * predicate: ('TVersion -> bool) -> 'TValue option member Event: IEvent From 82d03b5676dc1cdcd8ae6f328130aa54d69efee3 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 20 Aug 2026 12:57:36 +0200 Subject: [PATCH 38/43] StartAsTask in threadpool --- src/Compiler/Utilities/Async2.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 3d1b767bf6e..40f07f51a34 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -540,7 +540,7 @@ type Async2 = static member StartAsTask(computation: Async2<_>, ?cancellationToken: CancellationToken) : Task<_> = let ct = defaultArg cancellationToken CancellationToken.None - Async2.startImmediate ct computation + Async2.startInThreadPool ct computation static member RunImmediate(computation: Async2<'T>, ?cancellationToken: CancellationToken) : 'T = let ct = defaultArg cancellationToken CancellationToken.None From ccf508badbd4f1fbc23dc98f278ba3b73b83898e Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 20 Aug 2026 12:59:15 +0200 Subject: [PATCH 39/43] format --- src/Compiler/Facilities/BuildGraph.fsi | 1 + src/Compiler/Utilities/Async2.fs | 7 ++----- .../FSharp.Editor/Commands/XmlDocCommandService.fs | 3 +-- .../src/FSharp.Editor/Completion/SignatureHelp.fs | 4 +--- .../Diagnostics/SimplifyNameDiagnosticAnalyzer.fs | 3 +-- .../LanguageService/FSharpProjectOptionsManager.fs | 1 + .../FSharp.Editor/LanguageService/SymbolHelpers.fs | 13 ++++++------- .../src/FSharp.Editor/Navigation/GoToDefinition.fs | 5 ++++- .../src/FSharp.Editor/TaskList/TaskListService.fs | 3 +-- .../FSharp.Editor.Tests/Hints/HintTestFramework.fs | 5 ++++- .../tests/FSharp.Editor.Tests/QuickInfoTests.fs | 3 +-- .../SignatureHelpProviderTests.fs | 3 +-- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/Compiler/Facilities/BuildGraph.fsi b/src/Compiler/Facilities/BuildGraph.fsi index e3f5cc10e6b..106ed0de5db 100644 --- a/src/Compiler/Facilities/BuildGraph.fsi +++ b/src/Compiler/Facilities/BuildGraph.fsi @@ -4,6 +4,7 @@ module internal FSharp.Compiler.BuildGraph open System.Globalization open Internal.Utilities.Library + /// Contains helpers related to the build graph [] module internal GraphNode = diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 40f07f51a34..5e6c2167f9a 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -505,7 +505,7 @@ module Async2 = true) ) - let whenAll (computations: Async2<_> seq): Async2<'TResult array> = + let whenAll (computations: Async2<_> seq) : Async2<'TResult array> = async2 { let! ct = CancellationToken use lcts = CancellationTokenSource.CreateLinkedTokenSource ct @@ -518,10 +518,7 @@ module Async2 = return raise exn } - let inline map - ([] mapper: 'input -> 'output) - (computation: Async2<'input>) - = + let inline map ([] mapper: 'input -> 'output) (computation: Async2<'input>) = async2 { let! result = computation return mapper result diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs index 75895e29cc5..7a00e10341c 100644 --- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs @@ -69,8 +69,7 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w let! cancellationToken = Async2.CancellationToken |> liftAsync let! sourceText = document.GetTextAsync(cancellationToken) - let! parseResults = - document.GetFSharpParseResultsAsync(nameof (XmlDocCommandFilter)) |> liftAsync + let! parseResults = document.GetFSharpParseResultsAsync(nameof (XmlDocCommandFilter)) |> liftAsync let xmlDocables = XmlDocParser.GetXmlDocables(sourceText.ToFSharpSourceText(), parseResults.ParseTree) diff --git a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs index cd6d297ae1c..1f202e431de 100644 --- a/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs +++ b/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs @@ -613,9 +613,7 @@ type internal FSharpSignatureHelpProvider [] (serviceProvi ) = asyncMaybe { - let! parseResults, checkFileResults = - document.GetFSharpParseAndCheckResultsAsync("ProvideSignatureHelp") - |> liftAsync + let! parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("ProvideSignatureHelp") |> liftAsync let! sourceText = document.GetTextAsync() diff --git a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs index 048d559ed03..a7d61b3c435 100644 --- a/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs +++ b/vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs @@ -41,8 +41,7 @@ type internal SimplifyNameDiagnosticAnalyzer [] () = let! textVersion = document.GetTextVersionAsync(cancellationToken) let textVersionHash = textVersion.GetHashCode() - let! lockObtained = - guard.WaitAsync(DefaultTuning.PerDocumentSavedDataSlidingWindow, cancellationToken) + let! lockObtained = guard.WaitAsync(DefaultTuning.PerDocumentSavedDataSlidingWindow, cancellationToken) do! Option.guard lockObtained diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index 2e135902b5b..00df1a319b3 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -451,6 +451,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = reply.Reply ValueNone elif document.Project.IsFSharpMiscellaneousOrMetadata then let! options = tryComputeOptionsBySingleScriptOrFile document userOpName + if ct.IsCancellationRequested then reply.Reply ValueNone else diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs index 24751871db5..68fd01e9611 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SymbolHelpers.fs @@ -26,9 +26,7 @@ module internal SymbolHelpers = let userOpName = "getSymbolUsesOfSymbolAtLocationInDocument" let! ct = Async2.CancellationToken |> liftAsync - let! _, checkFileResults = - document.GetFSharpParseAndCheckResultsAsync(userOpName) - |> liftAsync + let! _, checkFileResults = document.GetFSharpParseAndCheckResultsAsync(userOpName) |> liftAsync let! defines, langVersion = document.GetFsharpParsingOptionsAsync(userOpName) |> liftAsync @@ -93,7 +91,8 @@ module internal SymbolHelpers = projects |> Seq.map (fun (project, snapshot) -> project.FindFSharpReferencesAsync(symbol, snapshot, onFound, "getSymbolUsesInProjects")) - |> Async2.whenAll |> Async2.Ignore + |> Async2.whenAll + |> Async2.Ignore TelemetryReporter.ReportSingleEvent(TelemetryEvents.GetSymbolUsesInProjectsFinished, props) } @@ -114,7 +113,8 @@ module internal SymbolHelpers = do! symbolUses |> Seq.map (fun symbolUse -> onFound currentDocument symbolUse.Range) - |> Async2.whenAll |> Async2.Ignore + |> Async2.whenAll + |> Async2.Ignore | Some SymbolScope.SignatureAndImplementation -> let otherFile = getOtherFile currentDocument.FilePath @@ -172,8 +172,7 @@ module internal SymbolHelpers = async2 { let symbolUses = ConcurrentBag() - let onFound = - fun document range -> async2 { symbolUses.Add(document, range) } + let onFound = fun document range -> async2 { symbolUses.Add(document, range) } do! findSymbolUses symbolUse currentDocument checkFileResults onFound diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs index ee4b5340a09..2ba928c5276 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs @@ -799,7 +799,10 @@ type internal FSharpNavigation(metadataAsSource: FSharpMetadataAsSourceService, TelemetryReporter.ReportSingleEventWithDuration(TelemetryEvents.GoToDefinition, [||]) let gtd = GoToDefinition(metadataAsSource) - let gtdTask = gtd.FindDefinitionAsync(initialDoc, position) |> Async2.startInThreadPool cancellationToken + + let gtdTask = + gtd.FindDefinitionAsync(initialDoc, position) + |> Async2.startInThreadPool cancellationToken gtdTask.Wait() diff --git a/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs b/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs index 76851de9781..cadae71acee 100644 --- a/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs +++ b/vsintegration/src/FSharp.Editor/TaskList/TaskListService.fs @@ -20,8 +20,7 @@ type internal FSharpTaskListService [] () as this = let getDefinesAndLangVersion (doc: Microsoft.CodeAnalysis.Document) = async2 { - let! _, _, parsingOptions, _ = - doc.GetFSharpCompilationOptionsAsync(nameof (FSharpTaskListService)) + let! _, _, parsingOptions, _ = doc.GetFSharpCompilationOptionsAsync(nameof (FSharpTaskListService)) return CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions, Some parsingOptions.LangVersionText } diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs index c9223e1c776..1e2a9606bbd 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/HintTestFramework.fs @@ -38,7 +38,10 @@ module HintTestFramework = let getHints (document: Document) hintKinds = let sourceText = document.GetTextAsync(CancellationToken.None).Result let span = Text.TextSpan(0, sourceText.Length) - let hints = HintService.getHintsForDocument sourceText document hintKinds span "test" |> Async2.RunSynchronously + + let hints = + HintService.getHintsForDocument sourceText document hintKinds span "test" + |> Async2.RunSynchronously let getTooltip hint = hint.GetTooltip document diff --git a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs index 8be322bbd74..8bd3b03e972 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs @@ -34,8 +34,7 @@ module QuickInfo = RoslynTestHelpers.CreateSolution(code, extraFSharpProjectOtherOptions = [| "--realsig+" |]) |> RoslynTestHelpers.GetSingleDocument - let! _, _, _, tooltip = - FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition) + let! _, _, _, tooltip = FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition) return tooltip } diff --git a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs index 09a832fa7cf..60f90c4124a 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs @@ -39,8 +39,7 @@ module SignatureHelpProvider = RoslynTestHelpers.CreateSolution(fileContents, options = project.Options) |> RoslynTestHelpers.GetSingleDocument - let! parseResults, checkFileResults = - document.GetFSharpParseAndCheckResultsAsync("GetSignatureHelp") + let! parseResults, checkFileResults = document.GetFSharpParseAndCheckResultsAsync("GetSignatureHelp") let paramInfoLocations = parseResults.FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn).Value From 5b53459daf790f383c1c8fdbd0659fd732f6c83e Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 20 Aug 2026 15:09:41 +0200 Subject: [PATCH 40/43] Revert "StartAsTask in threadpool" This reverts commit 82d03b5676dc1cdcd8ae6f328130aa54d69efee3. --- src/Compiler/Utilities/Async2.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 5e6c2167f9a..3380a5d66dd 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -537,7 +537,7 @@ type Async2 = static member StartAsTask(computation: Async2<_>, ?cancellationToken: CancellationToken) : Task<_> = let ct = defaultArg cancellationToken CancellationToken.None - Async2.startInThreadPool ct computation + Async2.startImmediate ct computation static member RunImmediate(computation: Async2<'T>, ?cancellationToken: CancellationToken) : 'T = let ct = defaultArg cancellationToken CancellationToken.None From 7b92b85288a9877a52a3a6b56ea2f4bd0b1a2052 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 20 Aug 2026 16:14:59 +0200 Subject: [PATCH 41/43] Fix Async2 cancellation compensation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Utilities/Async2.fs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 3380a5d66dd..8a84ad413ea 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -574,11 +574,14 @@ type Async2 = let! ct = Async2.CancellationToken let invocation = computation.Start ct - try - return! invocation - finally - if ct.IsCancellationRequested && invocation.Task.IsCanceled then - compensation () + invocation.Task.ContinueWith( + Action>(fun _ -> compensation ()), + TaskContinuationOptions.OnlyOnCanceled + ||| TaskContinuationOptions.ExecuteSynchronously + ) + |> ignore + + return! invocation } static member StartChild(computation: Async2<'T>) : Async2> = From 4540446851c7aa5e53f43f6cba7c9bf2cc14750f Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Thu, 27 Aug 2026 22:09:48 +0200 Subject: [PATCH 42/43] fix merge g Please enter the commit message for your changes. Lines starting --- .../src/FSharp.Editor/Common/DocumentCache.fs | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs b/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs index 11537e76378..3c740e44d0b 100644 --- a/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs +++ b/vsintegration/src/FSharp.Editor/Common/DocumentCache.fs @@ -6,7 +6,6 @@ open System.Threading open System.Threading.Tasks open Microsoft.CodeAnalysis open Internal.Utilities.Library -open Internal.Utilities.Library [] type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolicy: CacheItemPolicy) = @@ -19,25 +18,22 @@ type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolic let policy = defaultArg cacheItemPolicy (CacheItemPolicy(SlidingExpiration = (TimeSpan.FromSeconds defaultSlidingExpiration))) - new(name: string, slidingExpirationSeconds: float) = - new DocumentCache<'Value>(name, CacheItemPolicy(SlidingExpiration = (TimeSpan.FromSeconds slidingExpirationSeconds))) - - member _.TryGetValueAsync(doc: Document) = + static let tryGetCachedValueAsync (doc: Document, cache: MemoryCache) = async2 { let! ct = Async2.CancellationToken let! currentVersion = doc.GetTextVersionAsync ct - match cache.Get(doc.Id.ToString()) with - | null -> return ValueNone - | :? (VersionStamp * 'Value) as value -> - if fst value = currentVersion then - return ValueSome(snd value) - else - return ValueNone - | _ -> return ValueNone - } - - member _.SetAsync(doc: Document, value: 'Value) = + match cache.Get(doc.Id.ToString()) with + | null -> return ValueNone + | :? (VersionStamp * 'Value) as value -> + if fst value = currentVersion then + return ValueSome(snd value) + else + return ValueNone + | _ -> return ValueNone + } + + static let setCacheValueAsync (doc: Document, value: 'Value, cache: MemoryCache, policy: CacheItemPolicy) = async2 { let! ct = Async2.CancellationToken let! currentVersion = doc.GetTextVersionAsync ct @@ -47,11 +43,11 @@ type DocumentCache<'Value when 'Value: not struct>(name: string, ?cacheItemPolic new(name: string, slidingExpirationSeconds: float) = new DocumentCache<'Value>(name, CacheItemPolicy(SlidingExpiration = (TimeSpan.FromSeconds slidingExpirationSeconds))) - member _.TryGetValueAsync(doc: Document) : CancellableTask<'Value voption> = - fun ct -> tryGetCachedValueAsync (doc, cache, ct) + member _.TryGetValueAsync(doc: Document) : Async2<'Value voption> = + tryGetCachedValueAsync (doc, cache) - member _.SetAsync(doc: Document, value: 'Value) : CancellableTask = - fun ct -> setCacheValueAsync (doc, value, cache, policy, ct) + member _.SetAsync(doc: Document, value: 'Value) : Async2 = + setCacheValueAsync (doc, value, cache, policy) interface IDisposable with member _.Dispose() = cache.Dispose() From 4d52c27718a1fef488396dd5e8cb9afb0dbb2548 Mon Sep 17 00:00:00 2001 From: majocha <1760221+majocha@users.noreply.github.com> Date: Fri, 28 Aug 2026 21:51:27 +0200 Subject: [PATCH 43/43] rename awaited -> isNested --- src/Compiler/Utilities/Async2.fs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Compiler/Utilities/Async2.fs b/src/Compiler/Utilities/Async2.fs index 8a84ad413ea..6541b53f42c 100644 --- a/src/Compiler/Utilities/Async2.fs +++ b/src/Compiler/Utilities/Async2.fs @@ -133,7 +133,7 @@ module Async2Implementation = val mutable TailCallSource: TaskCompletionSource<'t> option [] - val mutable Awaited: bool + val mutable IsNested: bool [] val mutable CancellationToken: CancellationToken @@ -150,11 +150,11 @@ module Async2Implementation = [] val mutable StateMachine: 'm - member ts.Start(ct, awaited, ?tailCallSource) = + member ts.Start(ct, isNested, ?tailCallSource) = let mutable copy = ts let mutable data = Async2Data() data.CancellationToken <- ct - data.Awaited <- awaited + data.IsNested <- isNested data.TailCallSource <- tailCallSource data.MethodBuilder <- AsyncTaskMethodBuilder<'t>.Create() copy.StateMachine.Data <- data @@ -175,8 +175,8 @@ module Async2Implementation = member ts.TailCall(ct, tc) = ts.Start(ct, true, tc) |> ignore type Async2Dynamic<'t, 'm when 'm :> IAsyncStateMachine and 'm :> IAsync2StateMachine<'t>>(getCopy: bool -> 'm) = - member ts.GetCopy(awaited) = - Async2(StateMachine = getCopy awaited) :> Async2<_> + member ts.GetCopy(isNested) = + Async2(StateMachine = getCopy isNested) :> Async2<_> interface Async2<'t> with member ts.Start ct = ts.GetCopy(false).Start(ct) @@ -204,7 +204,7 @@ module Async2Implementation = let inline maybeBounce () = Async2Code(fun sm -> - if sm.Data.Awaited && Trampoline.Current.ShouldBounce then + if sm.Data.IsNested && Trampoline.Current.ShouldBounce then let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) if not __stack_yield_fin then @@ -306,8 +306,8 @@ module Async2Implementation = else Immediate state - let resumptionInfo awaited = - let initialState = if awaited then maybeBounce Running else Immediate Running + let resumptionInfo isNested = + let initialState = if isNested then maybeBounce Running else Immediate Running { new Async2ResumptionDynamicInfo<'T>(initialResumptionFunc, ResumptionData = initialState) with member info.MoveNext(sm) = @@ -354,7 +354,7 @@ module Async2Implementation = sm.Data.MethodBuilder.SetStateMachine(state) } - Async2Dynamic<_, _>(fun awaited -> Async2StateMachine(ResumptionDynamicInfo = resumptionInfo awaited)) + Async2Dynamic<_, _>(fun isNested -> Async2StateMachine(ResumptionDynamicInfo = resumptionInfo isNested)) member inline _.Run(code: Async2Code<'T, 'T>) : Async2<'T> = if __useResumableCode then