Notepad++ crashes and erases the file being worked on.
-
Yes, please let us know whether the content-copied version of the file has the same problems as the original.
The file sizes you mention are not large files, so it’s probably not an issue with large files. The session backup with huge files (roughly >100MB, IIRC) has had reported issues of zeroing out files before, but I’ve never heard of it doing that for such small files.
If it doesn’t solve it for you, the
Notepad++ > ? menu
is found on the menu bar of the Notepad++ window, andDebug Info
is in that menu. See below image for reference.
And answering @pnedev’s question for clarification on your template would help us help you, too.
And, as regards making sure I didn’t lose any more data: If I were in your situation, I would either automate version control software, as outlined below; or use cloud storage to your advantage, as descibed further below.
Version Control Automation
- Use my standard version control software (TortoiseSVN, Git, etc) to make sure that I would never loose too much data.
- Use a plugin such as NppExec, PythonScript, or LuaScript to automatically run an
svn commit
or equivalent. For example, in NppExec:-
I save the following script as “SvnCommit”
NPP_SAVE cd "$(CURRENT_DIRECTORY)" INPUTBOX "SVN commit $(FILE_NAME)" : "Message: " : cmd /c svn commit $(FILE_NAME) -m "$(INPUT)" cmd /c svn update $(FILE_NAME)
-
and then I use
Plugins > NppExec > Advanced Options
to place the SvnCommit script in the Macros menu
-
- Use
Settings > Shortcut Mapper
to assign a keyboard shortcut to the SvnCommit script. - Use that new keyboard shortcut every time you save this file
Cloud Automation
Alternatively, if you have a OneDrive, DropBox, or similar cloud-storage account, you could automate backing up your critical file into your cloud-storage folder:
-
edit your file in its normal location
-
save an NppExec script similar to the following as “SaveAndCopyToCloud”
NPP_SAVE NPP_SENDMSG NPPM_SAVECURRENTFILEAS 1 "C:\Temp\$(FILE_NAME)"
-
place “SaveAndCopyToCloud” in the Macros menu as described above, assign shortcut, and use that shortcut to save the file and copy it to the cloud
But since not all cloud-storages keep backups, and it might write the 0byte version to the cloud, you might want to put some additional scripting between to only copy it to the cloud folder if the filesize is bigger than 0 (or some other threshold). I couldn’t immediately figure out how to grab the filesize with NppExec: I could probably do it by grabbing the output from the windows
dir
command into NppExec, and somehow parsing it… but at that point, I’d probably switch to a different scripting language – I would do it in perl for myself, since I’m more comfortable in perl… but given that the random NPP user probably doesn’t have perl isntalled, I would probably suggest Python, because you could easily get an installation of Python integrated with NPP using the above link to the PythonScript download.If you would like a PythonScript solution to save the current file, then save a copy to a specified directory only if file-size is bigger than 0bytes (or some larger threshold), someone here could probably code it up pretty quick. I would need your patience and a day or two, because I’m not a Python coder, and have spent my distraction time for this morning on this reply, especially looking into the NppExec particulars for “save current file as”, but could probably figure it out eventually. However, there are plenty of people here with more Python/PythonScript experience than I have that could probably cobble together the save/filesize-check/copy-to-another-folder in a few minutes, if they want to take that challenge.
Anyway, good luck
-
-
I was using the last file that was created and using “save as” to a new file name. Then erasing the old data and entering the new data in the new file.
As I said previously, I am wondering if the “underlying” formatting for the original file (what we don’t see but is necessary to create a file behind the scenes) was corrupted.
Time will tell since I recently copy-pasted the data in the original file to a “new” file, thus getting rid of the old one completely. There is no connection between the two. This “may” resolve the issue.
-
Which Notepad++ version are you using. The phrase “I am using the very last version provided” is not precise.
-
This post is deleted! -
I just encounter the exact same problem today, notepad++ crashes and erases my file. As a general notice i have to say that notepad++ from a stable must use tool for the last 1-2 year it’s an unstable tool that crashes quite often, but so far i didn’t loose any work until today.
I’m using notepad++ in 3 different machines one with windows 10, one windows 7 and one which is an iMac with windows 7).
The problem today appeared on my imac windows 7 installation (works perfectly for 3 years), anyway here is my debug info from notepad++
Notepad++ v7.5.7 (32-bit)
Build time : Jun 29 2018 - 00:46:55
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 7 (64-bit)
Plugins : AutoSave.dll ComparePlugin.dll CSSExplorerAdapter.UNICODE.dll HTMLTag_unicode.dll JSMinNPP.dll NPPJSONViewer.dll NppSaveAsAdmin.dll PluginManager.dll XMLTools.dll DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll -
sorry for reposting after searching in google i find a solution, my missing data from the file was there %AppData%\Roaming\Notepad++\backup. solution link https://stackoverflow.com/questions/21712139/notepad-how-to-recover-a-deleted-file
-
@Dimitris-Stefanakis
Thanks man, this helped me a lot!
Just pressed ctrl+s and boom! Crash and file is emptyNotepad++ v7.5.8 (32-bit)
Build time : Jul 23 2018 - 02:03:53
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 8.1 (64-bit)
Plugins : ComparePlugin.dll DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll -
MINE AS WELL. I too have had the problem of notepad++ crashing and erasing my programs. I back my stuff up very regularly, but not always daily. At one point I know I had entirely too many open programs which did understandably crash it a couple times with no loss of data ( programs erased). I since refrained from excessive open programs. but after that, and with reinstalled newest version it started eating my programs. Html & javascript webGL locally ran applications I was developing. Twice it occurred while attempting to make 3D iframe alpha-transparent. First time I was able to save the open firefox instance of it and straighten out the DOM rearranged stuff. Second time it occurred I lost a weeks worth of work and was unable to save in that manner. Third time I wasn’t working on the 3D html, but a newest Three.js library test scene. I have started creating a little stack of three exact same versions of anything important I put in there now. It has been (notepad++) deleted and reinstalled ea time except this last time. The Toshiba windows 10 does not go online for any reason ever. I also would like this matter considered seriously. I LIKE my notepad++, I LIKE the dark background and light code script, styles. Why would I want to use windows notepad. I don’t have a clue what to use for alternative code editor, any proprietary-ware is out of the question. I wouldn’t even know where to start at troubleshooting why this would occur, I have looked for months for a post of this nature to begin addressing this very serious problem and only now just found it ( this post). I hope my reporting it here is in some way helpful, any additional information someone might need I have overlooked I will be happy to add. Thanks, freemnemoryerror (mike)
-
What is your Notepad++ version and could you briefly describe what exactly happened?
-
Sorry for delayed response. This site would not let me edit or
repost. I also appologize for not more thouroughly reading entire post before posting.current version: Notepad++v7.2 (64-bit)
listed under plugins: Converter, MIME Tools
Path 1st and 2nd instance of: C:\Program Files (x86)\Notepad++\notepad++.exe
Path 3rd instance of: somewhere else, on hard drive.
Admin mode : not sure and I can’t find where that would be listed
Local Conf mode : not sure and I can’t find where that would be listed
OS : Windows 10 (64-bit)No changes, no reicently installed programs, Notepad++'s machine never goes online.
saves were ‘Save’ not ‘Save as’
No use of online cloud anything ever.
First 2 deletions large file 3821 lines (145 KB)
Third deletion was small file.
The spellcorrect/suggestions thing was acting oddly between 2nd and third deletion incidents,
changing things on occasion.wifi was active in vacinity during all deletion incidents but not connected on machine. ( I’m Mike above)
-
@Mike-Depping , @logic-error ,
Does the problem occur often?
Is your Notepad++ periodic backup feature turned ON?Notepad++ version 7.6 has fix for this issue (or similar) so I’m trying to figure out if the fix covers your case as well.
Please update Notepad++ if you can and try with it.
I have to warn you though that the plugins installation and location paths have changed in 7.6 and that may lead to problems finding your plugins. You might need to manually fix that but there is nothing to worry about. You can find info about the new 7.6 plugin handling and paths in the community posts or here as well: https://notepad-plus-plus.org/news/notepad-7.6-released.html . -
Three times, or three deletions of my file being edited.
Under Settings > Preferences > Backup, I have:
Backup every 7 seconds, then it’s path does correspond with my current path.
Then under ‘Backup on save’ , NONE is selected with no custom backup directory added -
If you are going to stick with your version 7.2, I would suggest you turn all “backup” options off…and see what happens going forward…good luck.
-
I’m sorry again for slow responses, I get site error ‘HERE’
if I do anything other than enter a preprepared response.
This site won’t let me edit or immediate reply. prefer not to get wrapped up in all that as I already
have a nice little problem to work on.If not the v7.2 is there a version attainable you might recommend?
Thank you, So if I have this correct, I will go to my version 7.2 under:
Settings > Preferences > Backup
and uncheck the ‘Remember current session for next launch’? and
uncheck the 'Enable session snapshot and periodic backup,
remove the timer variables if they need removed after these are unchecked (I’m assuming they wont)
remove path, and leave None as None.Erasing ones programs is beyond MESSED UP, I would expect that kind of thing as a ploy for an
application to get one to turn pro/ proprietary ware, or a competitors taking advantage
of a weakness or vulnerability. thank you all again for your time. I see no real
altermative but to try to find another useable code editor, preferably one
that doesn’t just up and erase my stuff. -
I’m sorry, I couldn’t understand well your last post.
You know, every program has it’s flaws (some might be really critical), they stay dormant and unnoticed but when they appear and are known they get fixed and the cycle repeats.If you decide to continue using Notepad++ get version 7.6 or bigger and you shouldn’t have problems like the one you described.
-
I am amazed that so many people are having this problem, for so many years, and still there is no solution to it.
What’s the use of coding in so many features and functionality when basic stability is not looked at.
Today is 12-Mar-2020 and Win10 I believe updated overnight, and when I relaunch Notepad++ the whole session (a mix of saved and unsaved files) has disappeared, and I stare at a Blank file.
Obviously, no error messages, and hence no dump files, etc.I have ticked “Remember Current Session for next Launch”
And also “Enable Session Snapshot and Periodic Backup”. with a Backup every 7 seconds.But what is the Use of having a Session Backup System which will ditch you when you need it the most.
If there is a Periodic Session Backup system, then where are the Previous Backups. Can Notepad++ not recognize when it is over-writing a File with Data, with a Blank file.
We of course appreciate the Functionality of Notepad++ and fall heavily on it. We build our castles on it, and then type out data trusting it to keep it intact. And just when we least expect it, it pulls the rug from under the feet, and presents us a Neat Blank Page…
-
Don’t know for sure but I recommend for you to disable “Session Snapshot and Periodic Backup”.
I believe it is part of the problem rather than the solution.Notepad++ like other legacy GUI applications is almost entirely single threaded running the Windows message loop.
Last time I looked (admittedly long ago) it seemed that the snapshot feature adds multithreading into Notepad++ which is not properly synchronized/locked with the rest of the single threaded code. I believe that if “shit happens” when this backup thread is active, either files may be wiped or empty files are written into the backup and these empty files are restored on the next restart overwriting the OK files. I never enabled this feature and never lost a file.Feel free to use “Remember Current Session” since this feature just tell the main thread to save file locations before Notepad++ exits.
Some people are so lazy/unresponsible that they never save files and expect the snapshot to remember their modified files. But they really deserve to lose a few hours (or days) of work from time to time.
-
@gstavi ,
You are totally right about Notepad++ being mainly single-threaded and that the periodic backup uses multi-threading but that is not the problem.
I made PR maybe a year ago that fixed possible race conditions between the threads and it was merged. I also tested it at the time, @Claudia-Frank tested it too and periodic backups proved to be working properly.The problem remains to be the disk write caching that delays the actual write to the disk which leads to loss of data on sudden power loss or reboot (due to update for example).
I actually did this PR to fix the problem and in relation to these reported issues (https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6133 and https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5664) but it was rejected.Don has written in the release notes of the latest Notepad++ version this:
Fix Notepad++ doesn’t exit correctly while Windows 10 update restart.
I don’t know if that helps though and in what cases.
Here is the link: https://notepad-plus-plus.org/downloads/v7.8.5/
I’m sorry for your data loss, Notepad++ can really do better in that situation but I would advise you to always save your work and close Notepad++ when leaving the computer for longer periods (especially don’t leave it open overnight) to minimize the chances of this happening.
You could try using Recuva to try recovering your lost files.BR
-
@pnedev
Since I looked at the code much longer ago than 1 year then perhaps you fixed the things I saw back than.
I hope you indeed fixed ALL the races because this is one of the more difficult challenges for SW developers.I am not convinced about disk caching explanation because this should have made it a common problem for lots of application.
If it helps in any way I also made a patch that changes Notepad++ file api. My reason was that fopen was resetting file permissions and ownership over SAMBA. Specifically losing the ‘execution’ permission of script files. Perhaps a combination of reasons will convince @donho at some point.
Do remember it if you ever choose to fix the out-of-space bug by creating a new file since it will introduce the same problem. A new file will have default permissions rather then the possibly specific permissions of the original file.