session.xml is lost - overwritten by Notepad++ after crashes
-
After a few consecutive PC crashes with open Notepad++, I lost my working session. And it was huge… Over 100 unsaved files (drafts, texts) and some 30-40 open files from various locations in my PC.
Session.xml got lost and replaced - overwritten by Notepad++ !!
And, while I can recover unsaved files of that session from %APPDATA%\Notepad++\backup
I can’t manage right now to reopen all those 30-40 open files from around my PC… I just can’t remember them all, although they were important.I’ve to restore the previous version of session.xml with some data recovery software like Recuva, but unsuccessful!!
Notepad++ must back-up the session.xml itself !
-
FWIW, I run Notepad++ via a batch file that backs up several things for me, before running Notepad++.exe. It has come in handy several times to be able to grab an older file.
-
I just ran into the exact same problem. My C: drive was full, only 1.9MB free, because Windows decided to install updates in the background and fill my drive. Upon closing Notepad++, I got an error, something about it going to use an old session file.
I only had saved files open, but it’s still very annoying that this even happened… all my settings seem to be gone too, like my dark mode theme…I feel like this bug could easily be fixed. Only save the settings when there’s enough disk space available. Or first save the settings to a new file, and only overwrite the last settings when the saving was successful.
-
@Ennapocryph said in session.xml is lost - overwritten by Notepad++ after crashes:
I feel like this bug could easily be fixed. Only save the settings when there’s enough disk space available. Or first save the settings to a new file, and only overwrite the last settings when the saving was successful.
It’s not clear that there was a “bug” much less one that can “easily be fixed.” Your disk filled up and Notepad++ has been ordered to close/exit (either by the human or the the operating system). When that happens there is not much that applications can do that won’t upset a human somewhere. The human that believes they are in charge of a particular machine needs to make some decisions about what actions they would like to do and the order of those actions.
We could make some changes to Notepad++'s code that would increase the odds of the configuration plus session stuff being saved when the disk is both 100% full and things in the background are continuously grabbing every single available byte of disk space, and perhaps the system is in the middle of crashing or being shut down. Those change are not “easy” and can’t be guaranteed to work 100% of the time. Related to this is that some Notepad++ plugins also save configuration files.
Keep in mind that Notepad++ will not have, and can’t have, the same rights to system access as the Microsoft Windows’ Trusted Installer subsystem. The Trusted Installer can and will lock down our systems for minutes at a time while it works. The Trusted Installer does the lockdown as it does not want external processes to sneak in and to make changes, such as filling up the disk, while the Trusted Installer does the shuffle dance related to installing or updating Windows components and their configuration. I brought up the Trusted Installer here as that’s the thing that likely filled up your disk and is busy at work at the time you were trying to exit from Notepad++. The Trusted Installer will have priority over whatever applications such as Notepad++ want to do.
Finally, Notepad++'s design philosophy has been to be as lightweight and portable as possible. The configuration has always been stored in normal text files saved to a single folder or its sub-folders. Notepad++ does not use the Windows registry or database style transaction logs or whatever that would improve its ability to retain the settings in edge cases such as the disk is full and/or the Trusted Installer is busy.