nUpdate icon indicating copy to clipboard operation
nUpdate copied to clipboard

Updater doesnt work (Path may contain an empty string or just a space.)

Open TiToMoskito opened this issue 2 years ago • 5 comments

I am getting an error when my application is attempting to update.

This is the full stacktrace:

System.ArgumentException: Der Pfad darf keine leere Zeichenfolge sein oder nur aus Leerzeichen bestehen. bei System.IO.Directory.CreateDirectory(String path) bei nUpdate.UpdateInstaller.Updater.CopyDirectoryRecursively(String sourceDirName, String destDirName)

TiToMoskito avatar Apr 18 '22 07:04 TiToMoskito

Hi,

this is not quite easy to trace down as there is not enough information. What does the structure of your package look like? Especially the files you added.

dbforge avatar Apr 22 '22 20:04 dbforge

I'm starting to use your updater for our little pet project and I'm running into this error message as well. The files to replace are pretty straight forward as you can see in the screenshot.

The application is currently running in C:\Users\MyUser\Desktop\BClient. 2023-08-17  110400

How can I help to trace this problem?

gerricom avatar Aug 17 '23 09:08 gerricom

My appointment for this morning got cancelled, so I got some spare time to look into this. I recognized that one can see all arguments of nUpdateInstaller in the UAC, so my best guess was to check if those are right. I found out that startupPath was empty and that led me into UpdateManager.cs. Here I found out, that the executablePath is determined by the EntryAssembly.

That path is available while debugging the app but not in a release build. I guess this is because I use a single binary build. Fortunately the UpdateManager accepts a applicationExecutablePath. Here I handed in AppContext.BaseDirectory and appended the name of my executable.

Now nUpdateInstaller is capable of finding the correct paths and every works like a charm!

gerricom avatar Aug 17 '23 10:08 gerricom

@gerricom Ah, alright! Thanks for investigating further. I will note this because it should be documented in the README. Or would you mind opening a pull request for documenting what you found out? Also the empty path should be handled in the beginning as soon as the initialization is done and not throw a cryptic exception later.

I added the option exactly for this case that the path cannot be determined automatically by any circumstances, but I was not aware of this specific case.

dbforge avatar Aug 17 '23 16:08 dbforge

Or would you mind opening a pull request for documenting what you found out

I added a paragraph to the README and send you a PR.

Also the empty path should be handled in the beginning as soon as the initialization is done and not throw a cryptic exception later.

I'll look into this next week - I guess a MessageBox will do?

gerricom avatar Aug 18 '23 08:08 gerricom