When using EntryPoint attribute in fsx script top-level code is not executed #13350
Labels
Area-FSI
Bug
Impact-Medium
(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Let bindings still work, but side-effects are not executed.
Repro steps
script.fsx
:dotnet fsi script.fsx
Expected behavior
We see
Hello world
printed, as it is when there is no[<EntryPoint>]
used (sharplab - no EntryPoint).Actual behavior
Nothing is printed. (sharplab - with EntryPoint)
Known workarounds
Don't use
[<EntryPoint>]
in scripts - as it's not executed anyway, see #1431Considerations
Using
[<EntryPoint>]
in a script could just raise an error which would resolve this issue. It would cause a breaking change though for scripts that are imported from other scripts, because this currently works as expected:script1.fsx
:script2.fsx
:dotnet fsi script2.fsx
prints "Hello world"The text was updated successfully, but these errors were encountered: