@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.