microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.12k stars 28.52k forks source link

When I use vscode to open a folder, many empty file with invalid code automatically are generated. #145297

Closed na-an closed 2 years ago

na-an commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes/No

hello-smile6 commented 2 years ago

Could it be a disk issue? Maybe check the lost+found directory.

sean-mcmanus commented 2 years ago

The issue was a temp file string pointer that in some cases ended up pointing to memory that was deleted/invalid, so if that location in memory happened to be filled with a string for an existing file (that was writable), then that file could have been emptied. In most cases, the memory was filled with "garbage" data.

hello-smile6 commented 2 years ago

The issue was a temp file string pointer that in some cases ended up pointing to memory that was deleted/invalid, so if that location in memory happened to be filled with a string for an existing file (that was writable), then that file could have been emptied. In most cases, the memory was filled with "garbage" data.

Wow, that sounds problematic!

mean-ui-thread commented 2 years ago

FINALLY! I thought my hard drive was failing. This issue is exactly what I exprenced last week! I've lost half a day of uncommited code being worked on because of this bug. Many headers from my cross compiler got wiped out to 0 byte. I never consented to get pre-release of my exentions, but my settings.json had a C_Cpp.updateChannel set to Insider and I am certain that I didn't do that. Not sure how it happened.

rangsimanketkaew commented 2 years ago

Issue confirmed! It still keeps generating me a number of alien (invalid encoding) files.

sean-mcmanus commented 2 years ago

@rangsimanketkaew We shipped an update with a fix 12 days ago. What version (of the C/C++ extension) are you using? You should probably be using 1.9.7 (or 1.9.6, which is identical, but 1.9.5 a fix too). We haven't received any reports yet of invalid or erased files with those versions. If you repro the issue without the C/C++ enabled, then it's a different issue.

5wattbulb commented 2 years ago

I opened issue #145676 mentioned above. I am using C/C++ extension version 1.9.7 and I can't report any new rogue files being created but has anyone found a way of deleting the ones created earlier? I posted the below in #145676.

If you look at the screenshot in my opening post you'll see there's an option to 'Create File' which I only just noticed myself. Today I tried this option for one of the offending files, added content to it, saved it and then tried deleting it. The deletion seemed to go smoothly (i.e.. no error message) but the filename just immediately pops back into place in vs code explorer and, when clicking on it, I'm back to 'File does not exist' square one. Even tried renaming it 'rubbish' after saving it and, although 'rubbish' disappears after deletion the original gobbleydook name returns in explorer.

hello-smile6 commented 2 years ago

I opened issue #145676 mentioned above. I am using C/C++ extension version 1.9.7 and I can't report any new rogue files being created but has anyone found a way of deleting the ones created earlier? I posted the below in #145676.

If you look at the screenshot in my opening post you'll see there's an option to 'Create File' which I only just noticed myself. Today I tried this option for one of the offending files, added content to it, saved it and then tried deleting it. The deletion seemed to go smoothly (i.e.. no error message) but the filename just immediately pops back into place in vs code explorer and, when clicking on it, I'm back to 'File does not exist' square one. Even tried renaming it 'rubbish' after saving it and, although 'rubbish' disappears after deletion the original gobbleydook name returns in explorer.

What if you delete them by inode number?

5wattbulb commented 2 years ago

What if you delete them by inode number?

WOW. I had to look that up and then delete each one individually but it worked. I feel cleansed now. Thanks hello-smile6.