Notepad++ crashes and erases the file being worked on.



  • 2nd time today, within an hour. Had found a copy of the data and restored it. Then a few minutes later the same file crashed again. Luckily I had backed up all my NPP files after writing my posting so this time I had a copy readily available.

    I believe this is happening as I attempt to “save” the file. Instead the program crashes and erases it.

    This needs to be fixed as I have much more work than time to do it and having to keep backing up and then re-researching the data since the last backup is a total waste of time.



  • @W-C
    Maybe you should use notepad if notepad++ isn’t working out for you.



  • Yes, crashes are annoying (or worse), and loss of data even more so. If NPP is causing this loss of data, then it should definitely be fixed.

    It sounds vaguely like other issues I’ve seen on the forums – and it often has to do with very large files, or saving to network locations.

    You’ve given no details, which means anyone who tries to help you is just guessing. Please help us help you:

    • What version of Notepad++ are you using, and what plugins are installed ( Notepad++ > ? menu > Debug Info > Copy debug info into clipboard )?
    • if you run notepad++ with the -noPlugin command-line argument, does the problem persist?
    • How big is your file (kB, MB, GB)?
    • Where are they saved (harddrive, USB stick, network location, cloud folder)?
    • Does it happen for every file you edit, or just this one (or just a few)? If not every file, what’s the difference between this file (these files) and the ones that don’t crash.
    • Did you recently change something (especially in Settings > Preferences > Backup or > Cloud)?
      • what are your backup settings?
    • Did you recently install some other new unrelated application?

    Also, please remember that, while sometimes some of the developers visit, these forums are primarily populated by fellow users of NPP – and those who regularly read here generally want to help others.



  • Thank you very much for trying to help and being very constructive.

    • I am using the very last version provided.

    • I don’t seem to find where the debug info is located.

    • The plugin manager says the following plugins are installed. I have not installed any plugins except as provided automatically when upgrading.
      Converter
      MIME Tools
      others shown outside the PM that are: not listed in plugin manager)
      Npp Export
      NppFTP

    *-noPlugin command-line argument: where does this go? I don’t know IF I should add this. I also don’t think I use any of the default plugins installed.

    • Files are in the range of 4kb to 120 kb.

    • Saved on a laptop hard disk.

    • It seems to happen on one particular file (or files derived from one particular file. I use what I call a “template” when starting a new file, using the “layout” from one file and “saving as” another file (deleting the parts not needed in the new file and adding new data that applies to the new file. I hope this is clear.

    • I have just tried to resolve this problem by copying the data from the problem file, deleting the problem file, then creating a “new” file by pasting in the data and saving it as a new file. If it had anything to do with the underlying “formatting” of the old file I hope this might solve the problem. Only time will tell.

    • I was not aware of the backup settings. The first two boxes were checked and backup every 7 seconds, I assume the default setting. Changed it to 60 seconds. Backup on Save was none, changed it to “simple.” The problem is that it only saves one backup and erases previous backups by overwriting the previous one, sometimes leaving a backup with 0 bytes. It should save at least the last 3 backups to be fully effective. Maybe this can be an upgrade for a future release.

    • The crash occurs when I “attempt” to “save” a file (which I do every time I add a little bit of new data). Thus, backup may not be effective at times as it erases the previous one.

    • I use NPP primarily to construct and modify web pages. It is very good for that. Do NOT want to use Windows Notepad.

    • I have not recently installed another application.

    I hope that this will help give you a better idea of the issue.



  • Hello @W-C ,

    Could you please also clarify the following:

    It seems to happen on one particular file (or files derived from one particular file. I use what I call a “template” when starting a new file, using the “layout” from one file and “saving as” another file (deleting the parts not needed in the new file and adding new data that applies to the new file. I hope this is clear.

    When you say you are using one particular file as template how are you doing that? You open the template file and use “Save As” command? Or you are using the “Save a Copy As” command?
    That is important, thank you for providing that info.

    FYI: The “-noPlugin” option is provided on the command line if you are starting Notepad++ from the Windows cmd. You can also disable the plugins if you go to your N++ install folder, plugins subfolder and move all DLL files to the disabled subfolder there. To enable them again move them back as they where. However, I don’t think they are related to the issue you are seeing.

    BR



  • @W-C

    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, and Debug 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

    1. Use my standard version control software (TortoiseSVN, Git, etc) to make sure that I would never loose too much data.
    2. 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

    3. Use Settings > Shortcut Mapper to assign a keyboard shortcut to the SvnCommit script.
    4. 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:

    1. edit your file in its normal location

    2. save an NppExec script similar to the following as “SaveAndCopyToCloud”

      NPP_SAVE
      NPP_SENDMSG NPPM_SAVECURRENTFILEAS 1 "C:\Temp\$(FILE_NAME)"
      
    3. 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



  • @W-C
    if you want to go the python script way,
    here is described how it could look like. If you want modification, checks etc… let us know.

    Cheers
    Claudia



  • 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 empty

    Notepad++ 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)



  • @Mike-Depping ,

    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



  • @logic-error

    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.


Log in to reply