visual-studio-2010file-recovery

Recover a .CS class file after crash


I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty. it contained more than 1000 lines of codes before the class. is there anyway i can recover that file?

Help please because I don't have another copy of it (Stupid of me)


Solution

  • If you cannot find the source code file, try using Reflector to decompile the most recently built dll you have containing that class. It won't give you your complete source, but at least will give you something to start with.

    Note: Reflector is no longer free; if that matters, try dotPeek from JetBrains instead.

    Also, look into using a source code control system. This will let you 'commit' versions of your code to a repository, so you'll have a copy in case something like this happens in the future.

    Subversion, Git, and Mercurial are popular ones; In my opinion, Subversion would be the easiest to start out with, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don't want to worry about setting up a repository/server, look into a hosted solution, like Beanstalk, which offers Subversion and Git and lets you try it out with a free, limited account.

    Good luck - I hope you are able to recover your source!