Fixing the "Failed to save" error in Visual Studio Code? - windows

I recently installed Visual Studio Code 1.72.2 on a Windows 10 OS.
Since I started using it, I had a hard time when saving source files in VS Code, with the error message very frequently appearing and saying "Failed to save 'Test.py': Unable to write file '[file_path]' (Unknown (FileSystemError): Error: UNKNOWN: unknown error, open '[file_path]')"
When I create a workspace and the first source file, it actually saves without a problem. Then, after about 5-10 minutes of editing and debugging, the aforementioned error message suddenly pops up and I can't save the file from there on.
After searching Google many times, I could only find one post written by someone who was probably in an identical situation as mine (identical problems like files becoming corrupted after experiencing this "Failed to save" error), but the post was closed without any useful information.
I could find some posts about having "Failed to save" type of errors like File Permission error, but since my error exclusively says "UNKNOWN" I can't even guess what went wrong.
I already have tried disabling the installed extensions, but still no luck. This error happens regardless of the language of the source files, hence it shouldn't be a problem with a particular extension.
One last note, the file system I am using for source files and workspaces is D:, which is a 256GB external USB Mass Storage Device.
Any suggestions would be appreciated.

Related

TFS Check-in oddity causes file to become a different file entirely

I'm trying to figure out the root cause of a strange TFS error we are seeing in our current instance. It wasn't noticed until after a server move, but I'm not sure if they're directly related, because the error seems to be showing up for check-ins about a week prior to the move, as well as all those following it.
We first noticed the problem when I tried to get latest, and got several errors indicating:
"The downloaded file is corrupt. Please get the file again."
Upon looking into the error, we have noticed that starting as of a single check-in every code update has resulted in files being replaced with the contents of other files, ranging from project files to binary executable files (presumably assembly DLLs), rather than the expected content which is still present on our local development machines.
I don't have admin access to the servers myself, but am looking for ideas on possible causes and/or fixes for our team to investigate.
After weeks of searching, I finally found another mention of this sort of thing happening, along with a solution that appears to have worked.
Clear the Application Tier cache.
MSDN Archived Forums: TFS swapping contents of files

How to quickly clear thousands of CS0234 errors in Visual Studio 2019

This is a shared project that was working for me until today. It still compiles without errors in our CI system and for all of my teammates, but my computer started getting more than 3000 CS0234 errors when I compile this solution.
I tried cleaning the solution, I manually deleted the bin and obj folders, I deleted the packages folder and got all the NuGet packages again from the package source, I even rebooted my machine. Nothing helps.
These are not real errors, if I double click an error message, the source file opens initially with red ink, but this quickly disappears, then the error is removed from the error list.
I can fix my problem by simply double clicking each error and waiting a few seconds, but there are over 3000 error messages. My question is, is there a faster way to get Visual Studio back in sync. Since this only affects my machine there must be some kind of cache somewhere that's broken and if I could find it and delete it, maybe this situation would be resolved quickly.

What is fatal error C1090: PDB API call failed, error code '3': vc142.pdb?

I set up a new project with Visual Studio 2019 version 16.3.10. When I try to build I get the following error:
EasyTcpStubs.c : fatal error C1090: PDB API call failed, error code '3':
W:\Dropbox\Me (Mine)\TcpToNamedPipe\TcpToNamedPipe\Debug\vc142.pdb
I have searched the internet and this site for any explanation of this error. Maybe I missed it but I could not find anything.
The project is a Console project.
The error occurs without a line number so it does not seem to be the source. I tried another project and it compiles OK (but it is an old project whereas this error is occuring on a brand new project.
Does anyone know something about this?
For me, I stopped Dropbox and it works. It seems that something is using W:\Dropbox\Me (Mine)\TcpToNamedPipe\TcpToNamedPipe\Debug.
In my experience this error is likely due to some permission error. If your project is in Dropbox, OneDrive, etc, most likely you get this error because your Dropbox cannot sync and update files properly. Restart Dropbox and that should fix the issue.
In My case, I suspect it is some type of race condition/lock issue with the code that opens/closes the *.pdb file. In my case I am running /MP (Multiprocessor Compile) so up to 4 *.cpp modules being built at a time. It works fine on a stand alone build machine. But I'm a vendor and must use a VM environment to develop for my customer, and the disk requirements are so large I must place the builds on a network share.
The latency of file I/O access over a network share seems to be the issue.
Thats all I know about the issue at the moment.
As I learn/test discover more, I can improve this answer.
Synology Drive Client (v3.2.0) caused this error for me. Pausing the sync eliminated the error. Thanks to all for the clue of DropBox, OneDrive, etc. causing the issue.

Error signing output with public key from file snk - The process cannot access the file because it is being used by another process

Recently installed Visual Studio 2017 and opened an existing solution (previously opened in Visual Studio 2015). Everything seems to open fine. I can see the solution, files, edit files, etc... However, when I attempt to build the solution, I get the following error:
Error signing output with public key from file 'redacted.snk' -- The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
The closest related SO question I could find is this one here. I have attempted all of the recommendations with no success, including:
Cleaning my temp folder
Editing the csproj with the UseSharedCompilation tag
Set the "maximum number of parallel project builds" to 1
Restarted my computer
I'm running out of ideas on this one. Not sure what to try next. My hunch is that the error isn't 100% accurate (i.e. the file is not being used by another process), and that this has something to do with the upgrade to VS2017.
Any help would be greatly appreciated. Thank you.

MS Visual Studio 2010 Error Message

I have spent all day trying to get a program working. Now, MS Studio 10 stopped compiling, with an error message,
fatal error LNK1168: cannot open K:\Continuing Education\CCCCD\COSC1436\Prog10\Debug\Prog10.exe for writing
I'm guessing this means it ran out of memory somewhere. What do I need to do to get it working, again?
Possible reasons:
You have an instance of Prog10.exe running
K: drive is full
If K:is a network drive, it went offline.
Make sure you have write permission to the mentioned directory. Is that where your project is stored?
The error message is telling you that it couldn't write out the exe file, which usually means there's something wrong with write permissions for that directory.

Resources