AutoRecover


Menu:  Tools -> Options -> Environment -> AutoRecover
Versions:  2008,2010,2012,2013
Published:  6/30/2010
Code:  vstipEnv0019

 

=====

WARNING: Read the comments associated with this post as there are multiple complaints that this features doesn’t work as expected. Read this thread from the engineering folks about usage with versions VS2010 and older.

http://connect.microsoft.com/VisualStudio/feedback/details/731561/autorecover-on-new-files-does-not-work

=====

 

Perhaps your best friend is the AutoRecover feature.  It can be a real life saver if the dev environment crashes or there is a power outage or a meteor hits your cube (okay, maybe not that last one).  It’s very simple to use, just go to Tools -> Options -> Environment -> AutoRecover:

image

 

If you want to turn this feature off you can deselect the “Save AutoRecover information every” checkbox.  Of course, if you do this we will all laugh at you when you lose important work because you didn’t have it and I will personally blog about it so everyone knows–you might want to leave it on–just saying.  Here is what the other options do:

 

X minutes – determines how often files have AutoRecover information saved.  The default is 5 minutes but you can adjust up or down depending on usage.  There is an inverse relationship between this value and the frequency of your updates to code.  If you make more frequent updates to code then have a lower number here.  Fewer updates to code mean you can increase this number if you desire.  If you are going to make a mistake here make it on the side of a number that is too low rather than too high.  It’s better to take any performance hit from file I/O than to lose a ton of work.

 

X days – used to decide how long AutoRecover files are kept in the Backup Files directory.  The default is 7 days which is usually adequate for most situations.  If you work with a lot of projects over a short period of time then you may want to decrease this number to keep the Backup Files directory more clear.  If you are going to guess on this value then it’s better to guess high and lower the number as needed. 

 

 

 

Let’s be clear on what a is exactly saved and where it is saved.  First, recovered files are stored at \…\My Documents\Visual Studio <version>\Backup Files\<projectname>.  Not every file is saved here.  Let me show you an example:

 

Here is the backup folder for one of my solutions when I create it in Visual Studio:

image

 

Obviously the folder is empty.  Now let me make a change to a file and save the change.  Then I’ll wait 5 minutes to see the result:

image

 

Still nothing because there is no need to recover a saved file.  But let me make a change to a file without saving it and wait another 5 minutes:

image

 

NOW we have AutoRecover information because if there is crash we will have to make a decision to recover the unsaved changes or keep the last saved version.  This is essentially the function of AutoRecover.

 

 

 

When you do finally have to recover a file, this is the dialog you will get:

image

 

 

 

 

Recovered files – lists the file(s) that can be recovered with a a checkbox to select/deselect the file as well as basic information.

 

<File Name> Summary – shows detailed information about the currently selected file including date/time info, location of the backup file, and destination location where the file will be recovered to.

 

Recover Selected Files – performs a recovery action on the file(s) selected copying the recovered source file to the previously indicated destination.

 

Do Not Recover – closes the dialog box without recovering any of the files listed.

Comments (37)

  1. kelvin.mcdaniel says:

    Awesome. Thanks for explaining this one Zain!

  2. zainnab says:

    You bet Kelvin! 🙂

  3. Sameer Khole says:

    I have the autorecovery option to default i.e. 5min, 7days.

    ..was working on a report (SSRS) for the whole day (i.e. >>>>5mins)but when my VS crashed the autorecovery option had recoverd the version which was a day old. It was a very bad day …………

  4. ScottBai says:

    FAIL.  No auto recover files after a VS2010 crash.  Lost a little over an hour of work even though autorecover enabled and set to 5min/7days.  Nothing in the MyDocsVS2010Backup FilesMyProject either.

    I'm not the only one – I'm seeing posts from others with similar results.  Funny thing is that I've seen it work recently on the same machine, and even after restarting VS2010 I see files being created in that folder as I make changes.

    Houston, we have a bug.

  5. zainnab says:

    @Sameer and Scott

    I'm pinging the team to find out if this is a know issue or what the situation is here.  I'll post back here if I find out anything.

    Z

  6. moemoe says:

    how to change the directory for the backup files?

  7. Ted says:

    This feature does not seem to work.  Twice I have lost my connection (remotely logging in and working on a workstation at work).  SQL recovers the queries I have open but VS 2010 just ignores anything I had opened and did not have saved.  VERY FRUSTRATING!!!!!!  My environment is a 64 bit Win 7 workstation, is something about 64 Bit OS?  Why can't this work the way other programs work?  Is it because I have my projects linked to TFS?  I am just frustrated because I lost about 2 hours of work – I know, save often and I usually do, but this time I didn't and updated several classes and all of that work is poof gone because my internet went down at hmoe and I lost connection to my workstation.  It has been over a month, Z – anybody there have an answer why this "feature" is DOA?

  8. Andrew says:

    Lost about 2 hours of work, even though that feature usually works for me. VS2010 crashed, then it got automatically auto-restarted (usually I would see the "recover files" dialog), but it immediately crashed again (have no idea why, maybe the fact that it was the 4th VS running had something to do with it); the dialog did not come up when I started it again.

    64-bit WinXP, VS2010.

  9. StarTrekRedneck says:

    I think the VS team has tried to make this tool too clever. When I do save my work, the autorecover file is deleted. "Well, you don't need it then because it's saved." Not true. If the drive fails or if I'm working from a RAM drive, then I'm still hosed. The very old paradigm of just saving a .bak of everything in a location of my own choosing was a simple and very effective recovery model. I think someone tried to fix something that wasn't broken. Now I'm looking for a plugin for this functionality. I guess you get what you pay for…no wait!! This thing is *dang* expensive!

  10. Wildo says:

    Also lost an hour and a half of work…i just went to look for some documents when windows automatic updates restarted my pc….when visual studio 2010 automatically restarted, there was nothing to recover and no files in the folder either……….damn frustrating……….I agree with StarTrekRedneck…why not leave the recovery files in the folder and delete only after the 7th day??

  11. mrw says:

    I agree aswell, just experienced blue screen during run after a CTRL+S – an ASPX file became 1 KB wit no info and no recover file to be found!! 🙁

  12. sw says:

    I can confirm a not working backup strategy – at least concerning this auto recovery stuff.

    got an out of memory exception and suddenly after a vs restart there were 4k lines of code deleted. had to restore from backup but all recent changes were lost.

    this already happend twice…

  13. Dmitry says:

    Have same bad experience. More than other cases, main .cs file of project is damaged fully on VS crash. Auto recover folder is empty.

    Lost a lot of experimental work.

  14. Andy says:

    Visual Studio 2010 Express,

    not (Menu:  Tools -> Options -> Environment -> AutoRecover ??????)

  15. Pete Hurford says:

    Agree with some previous comments – AutoRecovery set to "on" in VS2010, VS2010 crashes, Backup Files folder empty, fortunately *only* 2 hours work lost.

    When VS restarted, no acknowledgement whatsoever that anything abnormal has happened.

  16. Attila Voros says:

    I agree this 'feature' is broken big time. My setting are the default 5min/7days. I had a crash and lost a single file in a solution – COMPLETELY, as in the whole file was overwritten with 0x00's.

    VS restarted like nothing happened. I check the backup directory – no files. Use Recuva to scan the backup directory – NO DELETED files either whatsoever,

    like nothing has ever been written there.

  17. John Reynolds says:

    Spent five hours updating a web app that's used annually. My "S" key is practically worn off because it hit CTRL+S so often. I also click the "save all documents" icon frequently. Sometime during the weekend my computer crashed. When I next launched Visual Studio, and it asked me if I wanted to restore. I knew I didn't because I hadn't worked on that project for a couple of days. I just never closed it. So I said "no." Somehow, my aspx page was rolled back to the very first change I made to it at the beginning of the previous Friday. Now I'm screwed. And pissed.

  18. Zoy says:

    Check if you got some "enc_temp_folder" folder in your solution, i could restore one of my files thanks to tmp files there.

    Hoping this will be debugged soon, it's quite an important feature…

  19. Marcel says:

    The location is my problem. In Company is everything fine, but from home with a vpn connection I have to wait 20 seconds every time because my home dir is mapped to a net share

  20. Matt Gulick says:

    I have lost 3 days worth of work twice!!!!!!!!!!!!! OMG, you can only image how upset I am.

  21. Marc F says:

    First, recovered files are stored at …My DocumentsVisual Studio <version>Backup Files<projectname>

    First, how wrong is that???

    They are saved to "My Documents" which, is in most cases, highly unlikely to be "..", and in many corporate cases likely to be on a shared network drive.  This can cause VS to freeze up every 5 minutes (depending on the setting) as it tries to access a slow network resource to auto save and to freeze on save as it cleans up autosaved files.

  22. Don says:

    Just lost 14+ hours of work.  Nice … just love throwing my life away.  Thanks Microsoft.

  23. Joaquin says:

    The feature is not working. The directory is empty and I lost a day of work!!!!!!!!!!!!!!!!!

  24. jfk says:

    not working. i lost 72hrs. thousand line code. :'( lost in 0.001 sec.

  25. Chris says:

    This feature is not working at all… I have lost 5 hours of coding.. what  a crap..

  26. Krzysztof says:

    Great! I was just debugging a simple multithreaded app and got BSOD. This happened to me the second time. On first crash I lost 4 hours of work. Today 3 days of work went pufff in smoke. Visual studio 2010 Express. Sad

  27. zainnab says:

    Okay, I'll do my annual checking with the AutoRecover cover team to see if the problems are outliers or the norm. I don't have line-of-sight to how often this happens but, based on the feedback here, I would have to conclude it is a high enough percentage to warrant looking into it. I'll post back here if I hear anything worth mentioning from the team.

    Z

  28. BrianW says:

    Same story….almost lost hours of work!

    BUT my home folder is actually located on a network drive which have the feature "Restore previos version" (a Windows server storage feature)…..an I manage to restore my auto-recovery files from there 🙂

  29. Hardik says:

    I lost my a day work… Come on Microsoft. Please resolve this issue ASAP…

  30. lynshyn says:

    thank you,I really need this now…

  31. Mario says:

    Terrible. An entire day of work gone, and it was hard work… Detaching the debugger from an audio driver sometimes leaves the whole system dead, somehow, and once in a while the required reset corrupts files. Formerly saved files. Damn, damn, damn!!! Studio 2010! Is it better in 2013 ?

  32. Fl0 says:

    Lost 8k of code (half of a day), twice. System is on SSD disk. Seems that bug is initiated at backup folder cleanup (last time = 7 days ago) when compiling a project. VS2010/C++.

  33. fadi says:

    Would changing the default directory affect it

  34. Raghav says:

    confused What to do is this will work or not suggest me

  35. Do NOT trust AutoRecover !! says:

    Same bad experience here, big crash when compiling, BSOD on Windows 7 x64 (first time I ever had one…).

    The result: the .cpp file I was working on was filled with NULL, and backup folder was empty…fortunately I made a manual backup of my project some days ago so i did not lose too much data.

    This AutoRecover option can't be trusted! find another auto backup solution for your project!

  36. NavyFlyer1325 says:

    STILL not working, apparently … else a MicroSerf would have posted a fix … typical.

  37. Marc Chamberlin says:

    HUMP! For a company that claims to be a software industry leader, not to design a development software package with decent auto backup and recovery features is just plain criminal and incompetent. In VS 2013, the visual designer apparently decided to remove a whole lot of graphical features on me, no warning, no complaint, just boom a whole lot of lost work. AND NO BACKUP FILES TO BE FOUND ANYWHERE TO RECOVER FROM. FWIW I have auto-recover set to 5 minutes, 7 days. HOW LONG have people been complaining about this oversight? And STILL NO FIX FOR IT???  If I were a manager at Microsoft I would be firing a bunch of idiots, but wait, that assumes Microsoft has competent managers…  Sigh….