• Login
Community
  • Login

Notepad++ lost track of open files / why?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
23 Posts 7 Posters 4.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P
    PeterJones @Alan Kilborn
    last edited by Sep 14, 2022, 1:56 PM

    @Alan-Kilborn ,

    A few years ago, before I had visual studio, I had thought I had compiled some C# using just the csc.exe that came with the .NET framework (c:\windows\Microsoft.NET\Framework\v4.0.30319\csc.exe or similar)… but I haven’t found my notes yet, and when I tried that with @sfcfs script, which I saved as recover-lost-session.cs, I got:

    recover-lost-session.cs(6,1): error CS0116: A namespace cannot directly contain members such as fields or methods
    recover-lost-session.cs(13,8): error CS1001: Identifier expected
    recover-lost-session.cs(13,10): error CS1518: Expected class, delegate, enum, interface, or struct
    

    But this isn’t a C# help forum, so I think I’ll stop trying.

    1 Reply Last reply Reply Quote 1
    • A
      Alan Kilborn
      last edited by Sep 14, 2022, 2:00 PM

      Maybe a PythonScript port of the C# code, so the “ask” only becomes obtaining a Notepad++ plugin?

      But I’m not going to do that, as my interest level is LOW for it. :-)

      P 1 Reply Last reply Sep 14, 2022, 5:58 PM Reply Quote 0
      • F
        Fabian Santiago
        last edited by Sep 14, 2022, 2:06 PM

        thanks gentlemen. lesson learned. fortunately, most of my tabs were in fact saved in named files so i didn’t lose much. i just have to re-open what i prefer to leave open for my purposes.

        i read thru the c# script and notes; my appdata backup folder is actually empty, so it won’t help me.

        thanks again.

        A 1 Reply Last reply Sep 14, 2022, 2:14 PM Reply Quote 1
        • A
          Alan Kilborn @Fabian Santiago
          last edited by Sep 14, 2022, 2:14 PM

          @Fabian-Santiago said in Notepad++ lost track of open files / why?:

          most of my tabs were in fact saved in named files

          This is good.

          so i didn’t lose much.

          Thankfully…

          all tabs were closed, unexpectedly

          We realize that loss of current session info – which sounds like the largest component of YOUR loss – is a tangible loss, as it takes effort to recreate it. :-(

          1 Reply Last reply Reply Quote 0
          • P
            pnedev
            last edited by Sep 14, 2022, 2:35 PM

            Hello @Fabian-Santiago ,

            I’m sorry for your problem loosing the session file.

            If you are willing to help diagnose the problem you could look for an xml file named nppSession… something (you will recognize it when you see it :) ) in your user config folder (C:\Users\your_user_name\Application Data\Notepad++) and if you find it upload it here (or its contents).
            It shouldn’t reveal any personal data only the process of closing Notepad++ before the reboot for updates but you better inspect its contents before sharing it here.

            That will probably be useful and surely appreciated, thanks.

            F 1 Reply Last reply Sep 14, 2022, 5:05 PM Reply Quote 1
            • F
              Fabian Santiago @pnedev
              last edited by Fabian Santiago Sep 14, 2022, 5:05 PM Sep 14, 2022, 5:05 PM

              @pnedev i don’t see a folder as you described. i assume you mean this folder: “C:\Users\fabian\AppData\Roaming\Notepad++”

              i don’t see any such file. its contents are:
              Screen Shot 2022-09-14 at 1.03.21 PM.png

              and my current session.xml is pretty bland:

              <?xml version=“1.0” encoding=“UTF-8” ?>
              <NotepadPlus>
              <Session activeView=“0”>
              <mainView activeIndex=“0” />
              <subView activeIndex=“0” />
              </Session>
              </NotepadPlus>

              anything else i can help provide? thanks for your help.

              P P 2 Replies Last reply Sep 14, 2022, 5:10 PM Reply Quote 1
              • P
                PeterJones @Fabian Santiago
                last edited by PeterJones Sep 14, 2022, 5:10 PM Sep 14, 2022, 5:10 PM

                @Fabian-Santiago said in Notepad++ lost track of open files / why?:

                anything else i can help provide? thanks for your help.

                @pnedev was asking for the contents of the nppLogNulContentCorruptionIssue.log file, which was in your directory listing screenshot. That file contains the debug information necessary for the developers to fix the problem.

                1 Reply Last reply Reply Quote 3
                • P
                  PeterJones @Alan Kilborn
                  last edited by Sep 14, 2022, 5:58 PM

                  @Alan-Kilborn said in Notepad++ lost track of open files / why?:

                  Maybe a PythonScript port of the C# code, …
                  But I’m not going to do that

                  Okay, if you won’t, I will: posted in the other thread.

                  1 Reply Last reply Reply Quote 2
                  • P
                    pnedev @Fabian Santiago
                    last edited by Sep 15, 2022, 11:54 AM

                    @Fabian-Santiago ,

                    That is exactly the folder I meant and the file we are looking for is nppLogNulContentCorruptionIssue.log as @PeterJones pointed out. I’m sorry for my very inaccurate description before, I really forgot the exact folder on Windows OS and the name of the log file (it appears on very rare and obviously unfortunate occasions).
                    So it will be helpful if you could upload that file (or its contents) here but please check to be sure it is not revealing any sensitive data.
                    Thanks.

                    F 1 Reply Last reply Sep 18, 2022, 4:02 PM Reply Quote 1
                    • P PeterJones referenced this topic on Sep 15, 2022, 1:10 PM
                    • F
                      Fabian Santiago @pnedev
                      last edited by Sep 18, 2022, 4:02 PM

                      @pnedev sorry my reply took so long. here you are. it won’t let me upload / attach the log file here so this is the content (there was nothing sensitive in it so this is fully intact):

                      2022-07-25 11:08:22 WM_QUERYENDSESSION =====================================
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8015/8015 bytes are written.
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3683/3683 bytes are written.
                      2022-07-25 11:08:24 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-07-25 11:08:24 WM_ENDSESSION
                      2022-07-25 11:08:24 WM_DESTROY
                      2022-08-19 10:43:58 WM_QUERYENDSESSION =====================================
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 6047/6047 bytes are written.
                      2022-08-19 10:43:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-08-19 10:43:58 WM_ENDSESSION
                      2022-08-19 10:43:58 WM_DESTROY
                      2022-08-23 12:10:06 WM_QUERYENDSESSION =====================================
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 5434/5434 bytes are written.
                      2022-08-23 12:10:07 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-08-23 12:10:07 WM_ENDSESSION
                      2022-08-23 12:10:07 WM_DESTROY
                      2022-08-23 23:44:57 WM_QUERYENDSESSION =====================================
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8256/8256 bytes are written.
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 5430/5430 bytes are written.
                      2022-08-23 23:44:58 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-08-23 23:44:58 WM_ENDSESSION
                      2022-08-23 23:44:58 WM_DESTROY
                      2022-09-12 14:54:17 WM_QUERYENDSESSION =====================================
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8352/8352 bytes are written.
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3707/3707 bytes are written.
                      2022-09-12 14:54:17 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-09-12 14:54:17 WM_ENDSESSION
                      2022-09-12 14:54:17 WM_DESTROY
                      2022-09-14 01:23:48 WM_QUERYENDSESSION =====================================
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 8366/8366 bytes are written.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 3709/3709 bytes are written.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-09-14 01:23:48 WM_QUERYENDSESSION =====================================
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is opened.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml 9398/9398 bytes are written.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\config.xml is closed.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is opened.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 193/193 bytes are written.
                      2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml is closed.
                      2022-09-14 01:23:48 WM_ENDSESSION
                      2022-09-14 01:23:48 WM_DESTROY

                      P 1 Reply Last reply Sep 19, 2022, 7:29 AM Reply Quote 2
                      • P
                        pnedev @Fabian Santiago
                        last edited by Sep 19, 2022, 7:29 AM

                        @Fabian-Santiago ,
                        Thank you. I hope it will be useful and give some insight on the cause of the problem.

                        BR

                        X 1 Reply Last reply Sep 19, 2022, 9:10 AM Reply Quote 0
                        • X
                          xomx @pnedev
                          last edited by Sep 19, 2022, 9:10 AM

                          @Fabian-Santiago

                          Thanks for the log!

                          Do you have your N++ autoupdate set ON? (Preferences -> MISC. -> Enable Notepad++ auto-updater checked)

                          @pnedev

                          This is the same pattern as in here .

                          The relevant thing is the last surprising duplicate of the WM_QUERYENDSESSION log, where the session.xml file evidently gets emptied (“2022-09-14 01:23:48 C:\Users\fabian\AppData\Roaming\Notepad++\session.xml 193/193 bytes are written.”)

                          So we are getting a little bit closer - now let’s discuss how this could happen.

                          If there were slightly different times in the duplicate log items at the end, I could suspect some N++ multi-instancing problem or N++ zombie/crashed process behind, but we have the same log-time everywhere. So I do not think so.

                          If it was a racing condition, the last two WM_QUERYENDSESSION items would probably be mixed together. So I do not think so.

                          I’m wondering if it cannot be a coincidence with the N++ autoupdating.

                          Any other thoughts?

                          A F 2 Replies Last reply Sep 19, 2022, 10:29 AM Reply Quote 2
                          • A
                            Andi Kiissel @xomx
                            last edited by Sep 19, 2022, 10:29 AM

                            @xomx
                            At the same time config.xml gets 1032 bytes bigger. Quite a big difference.

                            X 1 Reply Last reply Sep 19, 2022, 1:06 PM Reply Quote 1
                            • F
                              Fabian Santiago @xomx
                              last edited by Sep 19, 2022, 1:02 PM

                              @xomx yes i do:

                              Screen Shot 2022-09-19 at 9.02.17 AM.png

                              1 Reply Last reply Reply Quote 1
                              • X
                                xomx @Andi Kiissel
                                last edited by Sep 19, 2022, 1:06 PM

                                @Andi-Kiissel

                                Maybe it could be interesting to see the content of such config.xml too.

                                Now about something else - I have just checked the relevant N++ shutdown source code and I have the following crazy idea (I have not tested/debugged that yet):

                                • the WM_QUERYENDSESSION and WM_CLOSE messages share the same code part
                                • at the standard (user initiated closing of the N++ app) N++ shutdown, the N++ receives only the WM_CLOSE one from these two
                                • when a Windows restart occurs, while the N++ is still opened, the N++ receives both of them, WM_QUERYENDSESSION 1st and the N++ executes the same code part as the WM_CLOSE, then returns TRUE (when an user did not cancelled the Windows restart/shutdown)
                                • when an app sent TRUE to the Windows OS as a response to the WM_QUERYENDSESSION, that app shutdown continues, so the app should obtain the WM_CLOSE sometime later!
                                • and I think that this “double-execution” of the same code part can be the culprit

                                Look at this part - I think that during the 1st execution all the opened files are closed, so at the 2nd execution the session has not any opened files to store !

                                If I am right, the solution is to handle the WM_QUERYENDSESSION and WM_CLOSE separately.

                                P 1 Reply Last reply Sep 19, 2022, 7:02 PM Reply Quote 4
                                • P
                                  pnedev @xomx
                                  last edited by pnedev Sep 19, 2022, 7:05 PM Sep 19, 2022, 7:02 PM

                                  @xomx said in Notepad++ lost track of open files / why?:

                                  If I am right, the solution is to handle the WM_QUERYENDSESSION and WM_CLOSE separately.

                                  I haven’t looked at the code myself yet but that is a very good assumption @xomx .

                                  @Fabian-Santiago ,

                                  Could you also share your Backup settings tab?
                                  Thank you once again for the debug input.

                                  F 1 Reply Last reply Sep 20, 2022, 3:37 AM Reply Quote 1
                                  • F
                                    Fabian Santiago @pnedev
                                    last edited by Sep 20, 2022, 3:37 AM

                                    @pnedev yes:

                                    Screen Shot 2022-09-19 at 11.37.12 PM.png

                                    1 Reply Last reply Reply Quote 2
                                    • P
                                      pnedev
                                      last edited by Sep 20, 2022, 3:54 PM

                                      @xomx , All,

                                      I suspect that on occasions the periodic session backup might be triggered while in the process of WM_QUERYENDSESSION but that needs further investigation.

                                      BR

                                      X 1 Reply Last reply Sep 20, 2022, 7:01 PM Reply Quote 1
                                      • X
                                        xomx @pnedev
                                        last edited by xomx Sep 20, 2022, 7:03 PM Sep 20, 2022, 7:01 PM

                                        @pnedev

                                        There is also report mentioning a possible coincidence with a pending N++ auto-update.

                                        User has periodic backups enabled too.

                                        1 Reply Last reply Reply Quote 1
                                        14 out of 23
                                        • First post
                                          14/23
                                          Last post
                                        The Community of users of the Notepad++ text editor.
                                        Powered by NodeBB | Contributors