stevencohn / OneMore

A OneNote add-in with simple, yet powerful and useful features
Mozilla Public License 2.0
2.66k stars 223 forks source link

Value can not be null error during Archive #1548

Closed maphew closed 3 months ago

maphew commented 3 months ago

Problem to Solve

While Archiving a notebook I get the error "Value can not be null. Parameter name: input"

To Reproduce

  1. R-click on notebook in table of contents
  2. Select 'Archive', select a folder to save to

Archiving proceeds. There is a progress bar and many page titles go by (939 total). Periodically an additional popup appears saying something like "copying such-n-such". After some time, a minute or two, this error shows up. The "Archiving...." popup with progress bar is at about 20%:

Expected Behavior

The archive completes, or in event of error with a particular page, the name of that page is mentioned.

Screenshots

image

Environment (if applicable)

Additional Context

The notebook is 939 pages and ~108 MB according to results of Storage Analysis (last run a few days ago).

The output archive is created and does have a html files and attachments in it. It is incomplete, having 3 of about 25 sections.

Additional details forthcoming after I extract what look like relevent details from log file. I don't want to post whole thing as it's full of page titles I don't wish to share. A quick initial survey shows a lof access denied messages trying to delete files in temp folder. The tail end:

14|03:54:58.888| ..publishing page to C:\Users\maphe\AppData\Local\Temp\2ts3p0sj\Maphew notes\Quick Notes\Share via_172\Share via_172.htm
06|03:54:58.904| ..cannot delete C:\Users\maphe\AppData\Local\Temp\2ts3p0sj\Maphew notes
System.UnauthorizedAccessException
Message: Access to the path 'trilium.4606ab0f-08d5-4231-ad3d-8dbf45afe3ea.log' is denied.
Source: mscorlib
StackTrace:    at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
   at River.OneMoreAddIn.Commands.ArchiveCommand.CleanupTemp()
TargetSite: [mscorlib] System.IO.Directory::DeleteHelper()

10|03:55:00.033| ..cannot create archive
System.ArgumentNullException
Message: Value cannot be null.
Parameter name: input
Source: System
StackTrace:    at System.Text.RegularExpressions.Regex.Replace(String input, String replacement)
   at System.Text.RegularExpressions.Regex.Replace(String input, String pattern, String replacement)
   at River.OneMoreAddIn.PathHelper.CleanFileName(String name)
   at River.OneMoreAddIn.Commands.ArchiveCommand.<ArchivePage>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at River.OneMoreAddIn.Commands.ArchiveCommand.<Archive>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at River.OneMoreAddIn.Commands.ArchiveCommand.<Archive>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at River.OneMoreAddIn.Commands.ArchiveCommand.<Execute>d__13.MoveNext()
TargetSite: [System] System.Text.RegularExpressions.Regex::Replace()

10|03:55:00.037| ..cannot delete C:\Users\maphe\AppData\Local\Temp\2ts3p0sj
System.UnauthorizedAccessException
Message: Access to the path 'trilium.4606ab0f-08d5-4231-ad3d-8dbf45afe3ea.log' is denied.
Source: mscorlib
StackTrace:    at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
   at River.OneMoreAddIn.Commands.ArchiveCommand.<Execute>d__13.MoveNext()
TargetSite: [mscorlib] System.IO.Directory::DeleteHelper()
maphew commented 3 months ago

thank you!