Skip to content

FS1110 internal compiler error: task { let! } + open ReactiveUI on .NET SDK 10.0.301 #19936

@marklam

Description

@marklam

Summary

Any task { let! ... } expression in a file that has open ReactiveUI in scope fails to
compile with an internal compiler error:

Repro.fs(8,9): error FS1110: Internal error or badly formed metadata: not enough type parameters were in scope while importing

The same code compiles cleanly with the F# compiler in .NET SDK 10.0.204
(Microsoft (R) F# Compiler version 15.2.204.0 for F# 10.0) against the exact same
ReactiveUI assemblies, so this is a regression in metadata import between 15.2.204 and
15.2.301, not malformed metadata in ReactiveUI.

Repro

See https://github.com/marklam/fs1110-repro

dotnet build Repro.fsproj

with SDK 10.0.301 resolved (no global.json in this repo, so the latest installed SDK wins):

Repro.fs(8,9): error FS1110: Internal error or badly formed metadata: not enough type parameters were in scope while importing

The error points at the let! line. The entire source is:

module Repro

open System.Threading.Tasks
open ReactiveUI

let run (chooser : unit -> Task<int>) =
    task {
        let! file = chooser ()
        return file
    }

Remove open ReactiveUI (it is otherwise unused here) and the file compiles. The
open matters because let! overload resolution for the task builder considers
extension members brought into scope by the open; the compiler crashes while lazily
importing the metadata of one of ReactiveUI's generic extension methods.

What was checked / ruled out

Variation Result on 10.0.301
Bound type Task<int>, Task<int option>, Task<ICustomInterface option> (interface from a referenced project) all fail
LangVersion unset (default), latest, preview all fail
Nullable unset, enable, disable all fail
FSharp.Core implicit (10.1.301) and pinned 10.1.202 all fail
ReactiveUI 20.4.1 and 23.2.28 (latest stable) all fail
Same file without open ReactiveUI compiles
Identical code + identical referenced assemblies on SDK 10.0.204 compiles

In the original solution where this was found, dotnet clean, deleting every bin/obj,
dotnet build-server shutdown, and toggling graph-based checking
(--parallelcompilation) were also tried — the error is deterministic, not stale state.

Environment

  • Windows 11 Pro (10.0.26200), x64
  • Broken: .NET SDK 10.0.301 — F# compiler 15.2.301.0
  • Working: .NET SDK 10.0.204 — F# compiler 15.2.204.0
  • ReactiveUI 20.4.1 … 23.2.28 (any version tested)

Original context

Found in a ~70-project production F# solution where every ViewModel file
(open ReactiveUI + Elmish + task { let! ... }) failed with 9× FS1110 immediately
after the machine's SDK rolled forward from the 10.0.2xx band to 10.0.301
(global.json had rollForward: latestFeature). All failure positions were
let! x = (expr : Task<'T option>) lines; the minimisation above shows the
option/generics in the bound type are incidental.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions