7

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

bbrez1
  • 135
  • 2
  • 10
  • 3
    Surely you are using a version control system and/or maintaining backups? – Eric J. Sep 10 '12 at 20:43
  • There might be shadow versions of the file. Right click it in explorer and take a look. – asawyer Sep 10 '12 at 20:44
  • Can you still find the source files and open them in an external editor such as notepad++ to see your source code still exists? I wouldn't think a simple crash would delete your source files. – Kevin DiTraglia Sep 10 '12 at 20:44
  • I hope you see the value in source control tools after this at least. – asawyer Sep 10 '12 at 20:46
  • @Eric J. nope. Learned it the hard way now I guess. Can't get the source code back tried everything. Going to try .NET reflector now – bbrez1 Sep 10 '12 at 20:59
  • 1
    @bbrez1: Reflector should do a decent job of reconstructing the source code. – Eric J. Sep 10 '12 at 21:52
  • I personally use Dropbox and it has saved me a couple of times on these occasions, it also has the benefit of me being able to work from both my laptop and desktop fairly seamlessly. – Joe Shanahan Sep 10 '12 at 22:04
  • 1
    No backups whatsoever? Dude... – Justin Skiles Sep 11 '12 at 16:55

5 Answers5

2

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.

redditmerc
  • 125
  • 1
  • 6
  • It is a specific SSD issue. I've been catching it with Notepad++ too. https://stackoverflow.com/questions/12359131/empty-source-file-after-crash-in-visual-studio/68174634#68174634 – Andry Jun 29 '21 at 07:56
2

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

Will Wang
  • 537
  • 5
  • 7
1

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.

Andry
  • 2,273
  • 29
  • 28
0

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.

Paul Collingwood
  • 9,053
  • 3
  • 23
  • 36
  • Also.. don't do *anything* else while attempting this. I was in the middle of recovering a shadow copy of a large file a few months back, and Windows 7 decided to remove the shadow copy during the recovery operation for an unknown reason. – Eric J. Sep 10 '12 at 20:45
0

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.

Hassan Faghihi
  • 1,888
  • 1
  • 37
  • 55