config.xml reset debugging
-
I just had my
config.xml
unintentionally reset.I think it was probably my fault: I used a Run menu command
<Command name="Restart Notepad++" Ctrl="yes" Alt="yes" Shift="yes" Key="82" FolderName="N++ Folder/Config">cmd /c taskkill /im notepad++.exe && TIMEOUT /T 1 && start "" "$(NPP_FULL_FILE_PATH)"</Command>
which closes N++, waits, and then relaunches… But I only had a 1 second delay between exit and restart – that can sometimes be too short for Notepad++ to finish. (But normally when it’s too short, it just doesn’t open the new copy, because it saw there already was an instance open, and I’m in mono-instance mode.)What I assume happened this time is that N++ wasn’t done writing the previous
config.xml
(or the OS wasn’t done flushing the file, even though N++ had finished exiting) before the new instance tried to read the config file, so it recreated it from scratch.For now, I’ve increased the wait time to 5sec instead of 1sec, which should hopefully be enough for N++ to finish exiting before trying to restart. But if it happens to me again, especially when I’m not using my too-fast Run action, I’d like to be able to share useful behind-the-scenes info.
I know there are some of those zero-byte-file configs which turn on various behind-the-scenes debug logging: I don’t see one that looks like it’s specifically to track config files, though I would not be surprised if there are some of those that I haven’t been able to document in the User Manual section which lists 0byte configs.
Would the
nppLogNetworkDriveIssue.xml
have the information to track whenconfig.xml
writes and reads are triggered, or will that only show actual files rather than configs, or does that only work when actually on a network drive (my config is normal%AppData%
)or is there another one of those zero-byte-file triggers that will track the config file writing/reading?
(I tried looking for
config.xml
in the GH Issues tracker, but so far, I’ve either just found people who blame rather that help with the debug, or it’s specific to cloud/networking – but there are a lot of matches, and I’m only looking at the Issues with Titles that seem at least possibly related, rather than every issue that hasconfig.xml
mentioned, so I may have missed it due to my mental filter.)Notepad++ v8.7.4 (64-bit) Build time : Dec 4 2024 - 23:50:05 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF Periodic Backup : OFF Placeholders : ON DirectWrite : ON Multi-instance Mode : monoInst File Status Auto-Detection : cdEnabledNew (for current file/tab only) Dark Mode : OFF OS Name : Windows 10 Enterprise (64-bit) OS Version : 22H2 OS Build : 19045.5131 Current ANSI codepage : 1252 Plugins : AutoSave (2) ComparePlus (1.2) DSpellCheck (1.5) EnhanceAnyLexer (1.4) ExtSettings (1.3.1) MarkdownViewerPlusPlus (0.8.2) mimeTools (3.1) NppConverter (4.6) NppEditorConfig (0.4) NppExec (0.8.8) NppExport (0.4) NppFTP (0.30.19) NPPJSONViewer (2.1) NppLspClient (0.0.31) NppUISpy (1.2) PreviewHTML (1.3.3.2) PythonScript (3.0.18) QuickText (0.2.5.1) _CustomizeToolbar (5.3)
-
I checked: I already had the
nppLogNulContentCorruptionIssue.xml
file, but%AppData%\Notepad++\nppLogNulContentCorruptionIssue.log
doesn’t have any entries since October of this year (so, despite it tracking the config and session files, it wasn’t triggered by my Restart action (or whatever event occurred while I was doing that restart to reset my config.xml) -
@PeterJones said in config.xml reset debugging:
Would the nppLogNetworkDriveIssue.xml have the information to track when config.xml writes and reads are triggered, or will that only show actual files rather than configs, or does that only work when actually on a network drive (my config is normal %AppData%)
no, yes, no
- this logging trigger will not help you at all
or is there another one of those zero-byte-file triggers that will track the config file writing/reading?
- as it is - no, but I can easily modify the
nppLogNulContentCorruptionIssue
one if you like to (at the places you would need it, it currently only logs when the Windows restartisEndSessionStarted
is set too).
I tried to replicate your issue with a fresh v8.7.4 portable N++ set according to your Debug Info + using your Run command - and so far so good, no reset after the N++ restart.
Did you try also without your plugins?
Edit:
Ah, I see, it was just an one-only occurrence, right?
Did you have any larger modified files open at the time? -
@xomx ,
It’s been a one-off, so far. I just wanted to be able to gather additional information if it happens again.
There were only 1-2 open files, none of which would have been more than 10k at the time. But I have verified that with my plugins, it’s been taking 2-3 seconds for Notepad++ to fully close, so the 1 second delay is definitely not enough to allow it to finish shutting down.
If you could generate a debug binary where
nppLogNulContentCorruptionIssue
will log more often (especially when N++ gets whatever signaltaskkill /im
initiates), I would try that and then reply if it ever happens again or anything interesting is logged.I only brought it up here, rather than in Issues, because I’m pretty sure it’s just my close-and-immediately-open which confused things, which wouldn’t be a normal use case, or one that I would expect N++ to handle gracefully. It’s more that I think that maybe using me as a long-term testbench might be able find something useful for one of the other config-file-resets, like the word wrap getting randomly toggled off, or the various times people have complained that they lost their settings when they upgraded, even though the updater isn’t supposed to overwrite settings – I am wondering whether there is config.xml corruption when the OS forces the closure for the word-wrap user, or when wingup closes N++ for the people who lose settings when updating.
If creating a debugging-binary for me is more of a hassle than you think it’s worth, don’t worry; but if you think it could provide you with interesting information, feel free to message me with a download link for the binary, or @-mention me in a commit to a GH branch where I could download the artifact, whenever you get a chance.
-
I learned my lesson a long time ago, and I have a batch file that starts Notepad++. Before it starts it, it zips up a snapshot (into a zip file with a name derived from system date/time) of relevant config files. The batch file also removes older snapshots so this mechanism doesn’t use up too much disk space.
It’s a shame we have to take defensive action against our favorite software. :-(