FS3511 warning when using `for...in` in task CE with .NET SDK 6.0.400 in Release builds
See original GitHub issueIn 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
- 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#"
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.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:9 (5 by maintainers)
Top GitHub Comments
No, I pretty sure it’s a different issue. But that fix might’ve caused it to break in .400.
I encountered the exact same issue a few days ago, but it only shows up when I build in Release mode. Debug mode doesn’t seem to give me any warning.
Tried today building against dotnet
6.0.303
and6.0.400
. Both have the same behavior: no warning in debug build, warningFS3511
in release mode because offor .. in .. do
inside atask
.