bbrez1
bbrez1

Reputation: 135

Empty source file after crash in Visual Studio?

So I have been working on my game project in XNA for my diploma for 3 months now... was just finalizing everything and ready to submit when suddenly... BLUE SCREEN. Computer restarts and my main.cs file is full of stupid spaces. No more code. That's all that it was left out of my full source code... What can I do? Please help.

Thanks

Also: I'm going to cry

Upvotes: 7

Views: 4269

Answers (5)

Andry
Andry

Reputation: 2727

Zeroed file specifically happens on SSD drives. A write on such devices actually is a composite of zeroing + write for some reason. So you have a chance to lost a file. It has happened for me with 2 different SSD drives from 2 different manufactures. I have had lost a 1 hour work.. twice (and of cause I am using a Source Control system and it has nothing to do with that as mentioned here).

To fix that you have to look at some IDE plugin for backup at file edit time.

Some links.

MSDN:

Plugins:

Discussion:

How to restore a file:

In mine case I've used recovery software that can low scan a drive for lost or overwriten files. Simple unerase software won't help here. Previous time I've used Ontruck Easy Recovery Pro 5.0, but currently it can't detect new hardware. The last time - O&O Disk Recovery 8. Both shareware. Sometime it restores whole file, sometime a part (by 512 byte blocks, or something like that, other part has zero filled). You can choose extension of a file if you know that file extension you need (may be recover faster but not sure). After scan the selection filter does not work as supposed (don't ask why) so need to manually open a directory where the file was lost.

Upvotes: 1

Hassan Faghihi
Hassan Faghihi

Reputation: 2021

I had a light outage which is regular in my country, normally when VS ask me to recover my file, i always chose no since bad experience since old VS 2005, but this time on VS2019, I said yes as I had lot of work I didn't save manually.

And it gave me an empty file full of [nul] characters. leaving me an empty hand after a week worth of work.

Upvotes: 0

Will Wang
Will Wang

Reputation: 537

I run this matter too,as @Eric J suggested, I recoveried my code from decompiling the dll file which is generated by the latest compiling

Upvotes: 2

redditmerc
redditmerc

Reputation: 125

People who mention saving documents on regular or using a source control are such idiots really and not have the slightest clue of what this issue is about. I'm doing everything by the book.. even had the Auto Recovery configured, still after BSOD I arrived back to an empty source file! After bit of investigation, I realized that this is a known Visual Studio bug. My suggestion would be to use a cloud store service like GoogleDrive to keep a copy of your source files at all times.

Upvotes: 2

Paul Collingwood
Paul Collingwood

Reputation: 9116

If windows 7 right click on the folder or the file! Go into ots properties, and look for "previous versions" or similar. You may be able to revert back to an earlier version.

Upvotes: 0

Related Questions