Skip to content

FS3511 warning when using for...in in task CE with .NET SDK 6.0.400 in Release builds #13657

@sasmithjr

Description

@sasmithjr

In the latest SDK (6.0.400), I'm receiving a FS3511 warning with for...in loops in task when building for Release. This warning wasn't present in previous SDKs (e.g. 6.0.302)

Repro steps

  1. In a new console application, replace Program.fs with the following code:
let v =
    task {
        for value in [1;2;3] do
            printfn $"{value}"
    }
    
printfn "Hello from F#"
  1. dotnet build -c Release

Can repro with https://github.com/sasmithjr/FS3511-repro-for..in

Expected behavior

Builds without warning

Actual behavior

Receive the warning warning FS3511: This state machine is not statically compilable. A resumable code invocation at '(2,4--2,8)' could not be reduced. An alternative dynamic implementation will be used, which may be slower. Consider adjusting your code to ensure this state machine is statically compilable, or else suppress this warning.

Known workarounds

Suppressing the warning or using collection iter functions.

Related information

  • Operating system: macOS 12.5 on an M1 MBP
  • .NET Runtime kind (.NET Core, .NET Framework, Mono) .NET Core, SDK 6.0.400

Thanks for the help, and please let me know if I can provide anymore info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions