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?
Go to Tools | Options | Environment | Documents and uncheck the option called "Allow editing of read-only files; warn when attempt to save."
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With