Code-server: Cannot save *.cs or *.fs file.

Created on 31 Mar 2019  路  12Comments  路  Source: cdr/code-server


  • code-server version: 1.408-vsc1.32.0-linux-x64
  • OS Version: ubuntu 18.04 LTS

Description

In a directory that command dotnet new console was emitted, cannot save *.cs or *fs or etc file. And its content is lost. But in a directory that command dotnet new console was not emitted, no problem occurs.

Steps to Reproduce

  1. Open a directory, and dotnet new console.
  2. Edit *.cs file, try to save it.
  3. Cannot save a file, and its content is lost.
bug

Most helpful comment

I have the same issue too.
However, after deleting BOM from *.cs, I can edit and save the files.

All 12 comments

Will definitely fix. Thanks for the report!

I have the same issue.
Any file generated by dotnet core cli cannot save changes.
All other files (manually created) save normally.

There's another Discord user reporting the same problem. The dev console provides the following error when attempting to edit and save one of the .cs files:

ERROR  Failed to handle server message
c01964.bundle.js:53 id (String): event: open
c01964.bundle.js:53 length (Number): 24
c01964.bundle.js:53 error (String): s.encodeStream is not a function

encodeStream traces back to vs/base/node/encoding which uses the encodeStream function exposed by the iconv-lite package.


Running file -i on one of the .cs files indicates that the files are binary, e.g.

/home/coder/test/Program.cs: inode/x-empty; charset=binary

Edit: Version: 1.604-vsc1.32.0-linux-x64
Edit 2: The user said that refreshing, after generating the .cs files and before editing, allowed for editing and saving any files.

I have the same issue too.
However, after deleting BOM from *.cs, I can edit and save the files.

I have the same problem, however I dont see any logs anywhere (it also happen on .cs files) to me it seems related to the amount of characters of the file path example:
saving this file work -> /root/project/reborn/Constellation/Common/Common/Common.csproj (62 characters)
saving this file doesn't -> /root/project/reborn/Constellation/Common/Common.Realtime/Common.Realtime.csproj (80 characters)

The workaround of @wdstar works. See https://github.com/cdr/code-server/issues/597#issuecomment-490118664

@jeankedotcom the workaround of @wdstar did not work for me, the files are still impossible to save

root@c9964f6be211:~/project/reborn/Constellation# git diff /root/project/reborn/Constellation/Common/Common.Realtime.Events/Common.Sources/Hubs/EventsHub.cs
diff --git a/Constellation/Common/Common.Realtime.Events/Common.Sources/Hubs/EventsHub.cs b/Constellation/Common/Common.Realtime.Events/Common.Sources/Hubs/EventsHub.cs
index bc48407b..55719d55 100644
--- a/Constellation/Common/Common.Realtime.Events/Common.Sources/Hubs/EventsHub.cs
+++ b/Constellation/Common/Common.Realtime.Events/Common.Sources/Hubs/EventsHub.cs
@@ -1,4 +1,4 @@
-<U+FEFF>#region header
+#region header
 #pragma warning disable S125
 /* ************************************************************************** */

this git diff I rans how however that the BOM header was correctly removed, it's not enough :(

I'm sorry it does work ! I had to restart the webpage, for everyone that didn't thought about that lol

@kazakami @Rakiah can you try out the v2 previews to see if that fixes your issues?

I tried out and this issue seems to be fixed.
Thank you!!

Thanks for the input @kazakami, I'll mark this as fixed now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

korzq picture korzq  路  3Comments

Arsaev picture Arsaev  路  3Comments

oonqt picture oonqt  路  3Comments

RealSlimMahdi picture RealSlimMahdi  路  3Comments

nol166 picture nol166  路  3Comments