Skip to content

[Ide] Excessive Compilation.Emit due to Roslyn Compilation churn for C# references #20118

Description

@xperiandri

Description

When C# projects change, Roslyn creates new Compilation instances. The F# IDE integration currently uses a ConditionalWeakTable to cache the emitted PE reference from these compilations. Because new Compilation objects are continually created by Roslyn, the weak table cache misses, causing repeated, expensive metadata-only emissions (Compilation.Emit(metadataOnly=true)). This contributes to UI latency and background CPU churn.

Expected Behavior

We should add a cache based on a stable identifier, such as (ProjectId, project.Version), to avoid re-emitting assemblies unnecessarily when the underlying C# project hasn't functionally changed.

Actual Behavior

The IDE often experiences excessive background activity because it forces frequent PE emissions for the same actual logic state.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions