Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task builder produces warning if there are too many bindings inside IF branch #16068

Closed
Szer opened this issue Oct 2, 2023 · 3 comments · Fixed by #17076
Closed

Task builder produces warning if there are too many bindings inside IF branch #16068

Szer opened this issue Oct 2, 2023 · 3 comments · Fixed by #17076
Assignees
Labels
Area-Compiler-StateMachines Sequence, list, task and other state machine compilation Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@Szer
Copy link
Contributor

Szer commented Oct 2, 2023

build in RELEASE (debug is fine)
dotnet build -c Release

Reproducable on SDKs

  • 7.0.401
  • 8.0.100-rc.1
let repro() = task {
    if true then
        let c1 = failwith ""
        let c2 = failwith ""
        let c3 = failwith ""
        let c4 = failwith ""
        let c5 = failwith ""
        let c6 = failwith ""
        let c7 = failwith ""
        let c8 = failwith ""
        let c8 = failwith ""
        let c10 = failwith ""
        let c11 = failwith ""
        let c12 = failwith ""
        let c13 = failwith ""
        let c14 = failwith ""
        let c15 = failwith ""
        let c16 = failwith ""
        let c17 = failwith ""
        let c18 = failwith ""
        let c19 = failwith ""
        let c20 = failwith ""
        let c21 = failwith ""
        let c22 = failwith ""
        let c23 = failwith ""
        let c24 = failwith ""
        let c25 = failwith ""
        let c26 = failwith ""
        let c27 = failwith ""
        let c28 = failwith ""
        let c29 = failwith ""
        let c30 = failwith ""
        let c31 = failwith ""
        let c32 = failwith ""
        let c33 = failwith ""
        ()
}

Expected behavior

Code compiles fine

Actual behavior

warning FS3511: This state machine is not statically compilable. A resumable code invocation at '(2,14--2,18)' could not be reduced. An alternative d
ynamic 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

  • delete ANY binding from IF
  • OR delete IF

Related information

  • Win 10
  • NET SDK 7.0.401
@kerams
Copy link
Contributor

kerams commented Oct 2, 2023

#12839

@Szer
Copy link
Contributor Author

Szer commented Oct 2, 2023

@kerams there is no record though, only bindings :)

(and works only inside IF branch, outside is fine and you can make whatever amount of bindings)

@0101 0101 added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Compiler-StateMachines Sequence, list, task and other state machine compilation and removed Needs-Triage labels Oct 9, 2023
@vzarytovskii
Copy link
Member

vzarytovskii commented Apr 8, 2024

This particular issue is happening because we decide to split sub expression (in this case let-in, because of the size of expression is higher than threshold) in ComputeSplitToMethodCondition, and don't reduce it properly in LowerStateMachines, and it ends up in non-reducible ResumableCodeInvoke at certain point. Probably additional expression reducing is the right way to go (as @kerams suggested in the other issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-StateMachines Sequence, list, task and other state machine compilation Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants