Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do files occasionally turn into read-only mode after saving in Visual Studio?

I have a really strange problem with my Visual Studio. I usually press CTRL + S pretty often (call me paranoid, well however I got that habit some years ago now and I really don't want to get rid of it :-))

Now I had the issue that I was editing one file, changing a few dozen of strings according to a spec I had open in Word; so I switch around these two tasks pretty often, make one or two changes and then save.

The odd thing is, every once in a while, after saving, my file is suddenly in read-only-mode, so I cannot navigate through my changes (CTRL+Z/CTRL+Y) and have to reopen that file to continue to code and pray. Indeed it feels random to me when this occurs:

sometimes I only change 1 thing and save and then it's immediately read-only, well in other cases it will let me edit several things until it is stuck.

Someone else also experiencing this and maybe got a tip? Maybe I hit some magic hotkey or something?

like image 400
DrCopyPaste Avatar asked Jul 08 '13 15:07

DrCopyPaste


People also ask

How do I get out of read only mode in Visual Studio?

Go to Tools | Options | Environment | Documents and uncheck the option called "Allow editing of read-only files; warn when attempt to save."

Why is my file read only?

Are the file properties set to read-only? You can check the file properties by right-clicking on the file and choosing Properties. If the Read-only attribute is checked, you can uncheck it and click OK.

How do I make a Vscode file read only?

You can make the file read only in the file system. For Windows, from File Explorer, right click file, select Properties, then Read Only. Then each time you modify the file VSCODE warns you "Failed to save 'filename': File is read-only.


1 Answers

My bad, please check if your projects folder is not a synchronized one, so when you edit (change) your project, the backup tool starts to update in remote location for synchronization purposes, so locks the file.

like image 137
Alexis Alarcon Avatar answered Oct 12 '22 02:10

Alexis Alarcon