FAQ Desk: Crash caused my file to be all NULLs
Welcome to the FAQ Desk. You have likely been directed here because you asked about a file that was turned into all NULLs (all blank, but taking up space).
This generally seems to happen when there’s a full Windows crash.
Possible File Recovery
To see if Notepad++ happened to keep a backup (if you had enabled
Settings > Preferences > Backup), it would be in
%AppData%\Notepad++\Backup. For local/portable installs (check
? menu > Debug Info, and look for “Local Conf mode:”; if it says
ON, then it’s “local” or “portable”), the Backup directory would be (I believe) a subdir of wherever notepad++.exe is run from. (If you happen to be using NppFTP to remotely edit files on an FTP server, you might find a backup in
%AppData%\Notepad++\plugins\config\NppFTP\cache\.) But some people have reported even those automatic backups getting corrupted.
Any editing software can cause loss of data if Windows crashes. It’s almost impossible to be truly bulletproof against an OS crash. The best recommendation is, with any software as the editor, keep a backup of any important data. This can be done with dedicated backup software, or with storing your files in a service like Dropbox, One Drive, Google Drive, … Or using version control software, such as git or subversion.
Debugging the Problem
Unfortunately, you’re not alone in this problem. Computer crashes can cause unexpected behavior, and so far, no one in the development team has been able to reliably replicate the situation. Without a procedure that reliably replicates the problem, it is uncertain how to go about debugging a problem that cannot be seen. This problem is officially tracked in issue #2381 in the Notepad++ development repository on GitHub.
If you have a concrete, repeatable method of reproducing the problem, please post the procedure in issue #2381, and maybe the development volunteers will be able to also reproduce and thus debug and solve the problem.
Back in December 2017, @chcg summarized the history of the topic (https://notepad-plus-plus.org/community/topic/14945/rare-null-write-glitch/2), which @Scott-Sumner updated in January (https://notepad-plus-plus.org/community/topic/15112/attempt-to-recover-files-after-npp-blank-2-files-after-error-missed-the-error-msg/2)
Since then, there have been at least a few more posts on the issue in this forum (incomplete):
In March, I posted (https://notepad-plus-plus.org/community/topic/13302/fix-corrupted-txt-file-null/19) that I’d tried to force Windows to crash, but no matter what I did, I could not replicate the NUL-file issue. And @Scott-Sumner had tried the same thing some time earlier, as he revealed in the next post, with the same could-not-repeat-it results). This is a difficult issue to debug, and until someone steps forward with a reliable method of repeating it, it’s probably not going to get fixed.