Sangam Uprety
Sangam Uprety

Reputation: 1482

Visual Studio lost current code on sudden crash

My visual studio 2010 crashed when some carelessness [bit of madness] mistakenly pressed start button and my Acer timeline got unstable. Two projects where open at the time, one in visual studio 2005 [I have both 2005 and 2010 installed]. Unfortunately I lost all the codes I had done at the time along with those coded even weeks before. Now the project files in both the solutions are those weeks older. Amazingly, the .aspx pages are intact and .cs files are gone.

What can be done to get the lost data?

Upvotes: 4

Views: 23097

Answers (7)

sudoworld2001
sudoworld2001

Reputation: 1

A month recovery can be done in visual studio code 1 Right click on file and 2 click Open Timeline and 3 select file from timeline 4 the last time file saved by you 5 and your last change of the file is recovered

NOTE : Not only last but all the previously saved check points can be recoverd from vs code

NOTE: The answer is from the user 'Ashish Gautam' on another related thread. reproducing it here, so that someone can find it useful. Since its been lifesaver for me. Thanks.

Upvotes: -1

Sreejith ES
Sreejith ES

Reputation: 1

I could recover Such file in a similar situation By Using a data recovery software (in my case AVG Pc Tune Up, has an option to recover deleted files, It found a TEMP file in the Directory where the file was existing Which has data Until the last save, I copied the content in that file by opening with Notepad and Added to my project) , So Using a Data recovery Software MAY Solve your Situation

Upvotes: 0

Mishax
Mishax

Reputation: 4582

Guys TAKE CARE if your Visual Studio crashes, you need to check the backup BEFORE you restart Visual Studio and check if your files are ok! Many people complain that they lost work after a crash, and then they restart Visual Studio, and upon discovering that their code cannot be found in Visual Studio they then check the backup at the location

%USERPROFILE%\Documents\Visual Studio 2010\Backup Files\\

The order is important. Check the backup FIRST, before restarting Visual Studio. If you start Visual Studio and then open your old project it's probable that Visual Studio will overwrite the backup files for that project.

Securing the backup is your FIRST concern. Then start Visual Studio and open your project to see how much damage there is.

Upvotes: 5

Andrei Moiseev
Andrei Moiseev

Reputation: 4084

A very good file recovery tool is Recuva. It helped me once, didn't help me second time, though, because I noticed the data loss too late, and all recoverable data got overwritten.

So I used DotPeek, though you'll have to do a lot of work on the disassembled files, they are pretty weird.

Now I put my source tree in Google Drive, because it has file versions and keeps deleted files. Dropbox would do, too.

Git or any other VCS are not solution for this thing, because you cannot have crazy amount of meaningless commits.

Upvotes: 0

Drew Noakes
Drew Noakes

Reputation: 311007

I just had the same experience -- losing a source file during a BSOD. Very annoying!

No backup file could be found, and I searched the hard drive for a file containing the class name, but no backup was unturned.

However I was able to get back something resembling my code by decompiling a DLL from the bin/Debug folder using DotPeek. So if you had previously compiled your code successfully, you can get the code (without comments, and with some weird local variable names, etc) via decompilation.

Upvotes: 4

Jon
Jon

Reputation: 2532

You can check:

C:\Users\<username>\Documents\Visual Studio 2010\Backup Files\<ProjectName>\
C:\Users\<username>\Documents\Visual Studio 2005\Backup Files\<ProjectName>\

More information can be found here: Visual Studio 2010 AutoRecover Feature

Upvotes: 4

Captain overflow
Captain overflow

Reputation: 312

I Had the same problem, I lost code due to BSOD.

the backup folder should store files not saved until they are saved whenever you save the files there are deleted.

I think that maybe they don't remain after a restart as it was empty in my case.

Upvotes: 3

Related Questions