diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index bfc2d69c75..ec3fcca386 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -1058,11 +1058,17 @@ module IncrementalBuilderStateHelpers = let rec createFinalizeBoundModelGraphNode (initialState: IncrementalBuilderInitialState) (boundModels: ImmutableArray>.Builder) = GraphNode(node { use _ = Activity.start "GetCheckResultsAndImplementationsForProject" [|Activity.Tags.project, initialState.outfile|] - // Compute last bound model then get all the evaluated models. + + // Compute last bound model then get all the evaluated models*. let! _ = boundModels[boundModels.Count - 1].GetOrComputeValue() - let boundModels = - boundModels.ToImmutable() - |> ImmutableArray.map (fun x -> x.TryPeekValue().Value) + let! boundModels = + boundModels + |> Seq.map (fun x -> + match x.TryPeekValue() with + | ValueSome v -> node.Return v + // *Evaluating the last bound model doesn't always guarantee that all the other bound models are evaluated. + | _ -> node.ReturnFrom(x.GetOrComputeValue())) + |> NodeCode.Sequential let! result = FinalizeTypeCheckTask @@ -1071,7 +1077,7 @@ module IncrementalBuilderStateHelpers = initialState.enablePartialTypeChecking initialState.assemblyName initialState.outfile - boundModels + (boundModels.ToImmutableArray()) let result = (result, DateTime.UtcNow) return result }) diff --git a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs index f2cb16164a..2df8f930b9 100644 --- a/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs +++ b/vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs @@ -139,7 +139,7 @@ module internal RoslynHelpers = | :? OperationCanceledException -> tcs.TrySetCanceled(cancellationToken) |> ignore | exn -> - System.Diagnostics.Trace.WriteLine("Visual F# Tools: exception swallowed and not passed to Roslyn: {0}", exn.Message) + System.Diagnostics.Trace.TraceError("Visual F# Tools: exception swallowed and not passed to Roslyn: {0}", exn) let res = Unchecked.defaultof<_> tcs.TrySetResult(res) |> ignore ),