You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FSI sometimes gets confused by tabs: "Unexpected symbol # in interaction. Expected incomplete structured construct at or before this point" #14779
Area-VS-FSIVS window and commands for F# InteractiveBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Regression
Open Microsoft (R) F# Interactive version 12.5.0.0 for F# 7.0
Type in the following program
let three() =
3
Highlight the second line (" 3") and Send to Interactive.
Expected behavior
FSI should evaluate and return 3.
Actual behavior
Error.
System.IO.File.WriteAllText(@"C:\Users\wilso\AppData\Local\Temp\tmpE9F5.tmp.pid", string (System.Diagnostics.Process.GetCurrentProcess().Id));;
^
stdin(1,1): error FS0010: Unexpected symbol # in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Known workarounds
Un-indent code before sending it to F# interactive.
I'm experiencing this same issue with VS 2022 Version 17.5.1 and 17.5.2 as well.
The code inside of methods that used to be able to be sent and executed that has any indentation now reports the following error:
System.IO.File.WriteAllText(@"C:\Users\psimp\AppData\Local\Temp\tmp4367.tmp.pid", string (System.Diagnostics.Process.GetCurrentProcess().Id));;
^
stdin(1,1): error FS0010: Unexpected symbol # in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Note It seems the additional code that is sent by VS to fsi that does not appear in the interactive console has a bug in it. I believe it might be related to the System.IO.File call since it shows an indent in front of the expression.
Just FYI, selecting from a first (non-whitespace) character in the first line of selection seems like a good workaround:
Selecting from the beginning of a line still gives the same error, so it still needs fixing.
@abonie That workaround only works if you're selecting one item at that indentation level. If you selected two items it would give an error. For example with this code:
letf()=()letg()=()
If you select both functions but only from the first let, what you're actually sending to FSI is this code which doesn't compile because the indentation is off:
letf()=()letg()=()
The only actual workaround I know is to temporarily unindent all of the code so it starts at column 1, select it, send it to FSI and undo the indentation. It's really awkward.
This is a relatively recent bug. I was a little bit behind on updating VS and F# locally, but now I'm experiencing the same behavior. As others have already mentioned, it is a really confusing and annoying error, and non-trivial to work around.
Also of note, I lose the prompt and it doesn't come back.
When will this actually show up in a Visual Studio preview? 17.7 preview 3 was release today and this still doesn't work.
Is there a way to know what fsharp releases are going into a VS preview release?
Is there a way to build the VS integration and side load it into VS would that be in the contributor section?
I can confirm that building from main and installing the VSIX does have the fix then.
From: Vlad Zarytovskii ***@***.***>
Sent: Wednesday, July 12, 2023 3:25 AM
To: dotnet/fsharp ***@***.***>
Cc: Patrick Simpson ***@***.***>; Comment ***@***.***>
Subject: Re: [dotnet/fsharp] FSI sometimes gets confused by tabs: "Unexpected symbol # in interaction. Expected incomplete structured construct at or before this point" (Issue #14779)
The fix should have been in p3, not sure why it still shows
cc @KevinRansom<https://github.com/KevinRansom>
—
Reply to this email directly, view it on GitHub<#14779 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADTVWHQHFFLFV7PHZGNGFODXPZUPLANCNFSM6AAAAAAVDZQH2U>.
You are receiving this because you commented.Message ID: ***@***.***>
Area-VS-FSIVS window and commands for F# InteractiveBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Regression
Activity
PatrickSimpsonGFCMSU commentedon Mar 17, 2023
I'm experiencing this same issue with VS 2022 Version 17.5.1 and 17.5.2 as well.
The code inside of methods that used to be able to be sent and executed that has any indentation now reports the following error:
System.IO.File.WriteAllText(@"C:\Users\psimp\AppData\Local\Temp\tmp4367.tmp.pid", string (System.Diagnostics.Process.GetCurrentProcess().Id));;
^
stdin(1,1): error FS0010: Unexpected symbol # in interaction. Expected incomplete structured construct at or before this point, ';', ';;' or other token.
Note It seems the additional code that is sent by VS to fsi that does not appear in the interactive console has a bug in it. I believe it might be related to the System.IO.File call since it shows an indent in front of the expression.
PatrickSimpsonGFCMSU commentedon Mar 17, 2023
This is also happening on:
Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.6.0 Preview 2.0
as well.
I was not able to revert back further than 17.5.1 but I know it was working 8 weeks ago or so.
vzarytovskii commentedon Mar 17, 2023
Yeah, I still see it on latest
maincc @KevinRansomabonie commentedon May 4, 2023
Just FYI, selecting from a first (non-whitespace) character in the first line of selection seems like a good workaround:

Selecting from the beginning of a line still gives the same error, so it still needs fixing.
theprash commentedon May 4, 2023
@abonie That workaround only works if you're selecting one item at that indentation level. If you selected two items it would give an error. For example with this code:
If you select both functions but only from the first
let, what you're actually sending to FSI is this code which doesn't compile because the indentation is off:The only actual workaround I know is to temporarily unindent all of the code so it starts at column 1, select it, send it to FSI and undo the indentation. It's really awkward.
abelbraaksma commentedon May 22, 2023
This is a relatively recent bug. I was a little bit behind on updating VS and F# locally, but now I'm experiencing the same behavior. As others have already mentioned, it is a really confusing and annoying error, and non-trivial to work around.
Also of note, I lose the prompt and it doesn't come back.
jimfoye commentedon Jun 12, 2023
So, I think everyone realizes this, but just to clarify, the problem is any indentation, not just tabs. The issue title should probably be changed.
patrickallensimpson commentedon Jul 11, 2023
When will this actually show up in a Visual Studio preview? 17.7 preview 3 was release today and this still doesn't work.
Is there a way to know what fsharp releases are going into a VS preview release?
Is there a way to build the VS integration and side load it into VS would that be in the contributor section?
vzarytovskii commentedon Jul 12, 2023
The fix should have been in p3, not sure why it still shows
cc @KevinRansom
patrickallensimpson commentedon Jul 12, 2023
vzarytovskii commentedon Jul 12, 2023
Ah, probably wasn't inserted then.
vzarytovskii commentedon Jul 19, 2023
Fixed in #15384