I have had 3 occasions today where my work disapeared. Here’s the scenario:
I have multiple programs opened simultaneously. Let’s call one of them prog1.ino. I open this program with an existing program already written with the intention of modifying this program. I do my work, I save my work but leave the program open on my desktop. I then work on other programs throughout the day. On 3 separate occasions today, I came back to my prog1.ino and it had reverted back to the pre-modification code. I tried closing without saving and re-opening the version I had saved but it is also back to the original before mods. I am currently doing a test with a file I have saved and actually too a screen capture of the code and the save timestamp of that file. I have closed it and re-opened it and the code is still there. I’m leaving it open overnight to see what happens. But I am really curious if anyone ever experienced something similar. I currently have auto-save off because I don’t like overwriting my code before I save it with a new name. I lost too many versions with the auto-save. But this issue is just weird.
I normally have several work spaces open with several IDEs running concurrency and switch back and forth without a problem. I use Linux and have not had that problem, however others have. See if this link helps: A Good Install of IDE2.x - #2 by sterretje
Some relevant info is needed. OS, IDE version, are sketches in the cloud or not.
What program are you referring to? Do you mean an Arduino sketch (file extension of ino)?
Given the severity of losing source code I would check the github issues to see if it has been reported.
Please verify that the sketch is in a saved state when the loss of work occurs.
Is the sketch saved on a location that is using a cloud storage service (e.g., Microsoft OneDrive, Dropbox, Apple iCloud), or on a network share drive? Or is it just saved to a normal folder on your local hard drive?
I asked about the state of the sketch at the time of the data loss because there is a known bug in Arduino IDE that causes the loss of unsaved work if the PC goes through a sleep cycle:
However, this only affects unsaved work, so if you are experiencing data loss even when the sketch is in a saved state, then that would be caused by some different problem than the one identified by the above issue report.
Thanks for taking the time to post an update. I'm glad we have at least identified the specific conditions under which the fault occurs, and verified that the bug is being tracked via a formal report.
The available workaround is to enable the "Auto Save" preference. I understand that this may not be palatable to those of us who prefer to exercise control over when our projects are saved. Alternatively, you can be careful to always manually save your sketch when you halt work on the project. Just as I prefer to trigger saves manually, I also like to have control over when my PC sleeps. So for me it is natural to save work before I manually put my PC to sleep. However, in the case where the PC is configured to automatically sleep after some period of inactivity, it may be more difficult to remember to trigger a save since the sleep isn't triggered by an explicit action.