Skip to content

Perf: .Result blocks MailboxProcessor thread in FSharpProjectOptionsManager #20125

Description

@xperiandri

Description

FSharpProjectOptionsManager.fs's hasDependentVersionChanged used blocking .Result calls on GetDependentVersionAsync(ct).Result when comparing non-F# project references. Since this function is invoked from isProjectInvalidated, which is called from tryComputeOptions / tryComputeOptionsBySingleScriptOrFile inside the FSharpProjectOptionsReactor's MailboxProcessor loop, these synchronous waits could block the single-threaded reactor loop during project invalidation, causing UI/background responsiveness issues.

Repro / Evidence

Identified via CPU profiling of background F# editor activity in Visual Studio; located via code search for .Result usages in vsintegration/src/FSharp.Editor.

Fix

Convert hasDependentVersionChanged and isProjectInvalidated to cancellableTask workflows using let! instead of .Result, so the invalidation path is fully async and no longer blocks the mailbox loop.

Priority

P2 (medium-term)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions