Lukas Boersma
Lukas Boersma

Reputation: 1082

Unexpected character '' in implementation file

I have a F# file test.fs that contains nothing but a comment:

// test

When I try to compile it in Visual Studio, I get the following error:

FS0010 Unexpected character '' in implementation file [...] test.fs

I get the same error when I add some code or other content to the file. The error always occurs at the first non-blank line. Other files are still working, so I assume my compiler is working.

I use F# v4.1, Visual Studio v15.3.5, MSBuild v15.3.409.

What does the error message mean and how can I fix it?

Upvotes: 1

Views: 1159

Answers (1)

Honza Brestan
Honza Brestan

Reputation: 10947

Looks like a non-printable character somewhere near the beginning of the file. Open the text file in an editor that can show them, then delete the offending char. The usual suspect is a UTF byte order mark in an environment/OS that doesn't handle it well.

Upvotes: 6

Related Questions