views:

134

answers:

2

Just got a random bsod on my machine and Form1.cs is suddenly empty, any way to restore the code? thanks..

+5  A: 

You could check C:\Documents and Settings\UserName\My Documents\Visual Studio 2010\Backup Files\ (or the equivalent on your system).

Files will be placed there if auto-recover is enabled, which I believe it is by default. If you want to check that feature is enabled, follow the steps here: http://blogs.msdn.com/b/zainnab/archive/2010/06/30/autorecover-vstipenv0019.aspx

Another top tip is to set 'Save all changes' before building. That setting is in Options, under Projects and Solutions / Build and Run.

PaulG
The folder is empty, the bsod occured when I started the compiling process.
user471570
Sorry to hear that. I updated answer with another setting that may help prevent this next time.
PaulG
@PaulG: I thought 'Save all changes' was the deafult setting ???
Mitch Wheat
@PaulG: Thanks, back to rewriting it. :)
user471570
A: 

I'm sorry that you've lost your code, but the real answer is that your version control system should be providing this functionality. Failing that, you've got backups, right?

Andrew Aylett