Automatic Update - Single Instance Problems

Hello again,

I' using the AutomaticUpdater for my application. It's a WPF app, but I'm using the backend as I cannot (and don't want to) use the AutomaticUpdater for WPF (the WPF element MUST be in a window and cannot be in an user control etc.).

The problem:1. I start my application2. Mechanism starts to search for updates3. Updates found4. Start downloading updates5. Getting downloading failed error, that there is no connection to the newer wyUpdate.exe "wyUpdate exited prematurely":"Failed to connect to the new version of wyUpdate.exe"

6. The updater now continues to start my application over and over again with following parameters:[0] = "C:\\Users\\company\\wc\\5\\selfupdate\\base\\MyApplication.exe"[1] = "-cdata:C:\\company\\MyApplication\\client.wyc"[2] = "-basedir:C:\\company\\MyApplication\\ "[3] = "/autoupdate"[4] = "/ns"

I do have a single instance application and therefore I get a lot of messages like "instance already running" (from my instance helper).

I have also tried to update directly via the wyUpdate.exe and the urlargs. The download and the update was successful but after starting the application and after loading the backend, I get following:

1. Before downloading event2. Downloading failed, wyUpdate exit prematurely 3. Something tries to start the software with following parameters:[0] = "C:\\company\\MyApplication\\wyUpdate.exe"[1] = "/autoupdate"[2] = "-urlargs=..."

This time, the "instance already exists" message occurs only one time (means that my software is started only one more time).EDIT: After some testing I found out that wyUpdate.exe get replaced by my main application exe, but the name stays the same. - myapp.exe (375kb)- wyUpdate.exe (375kb)

EDIT2: After deleting wyUpdate.exe and client.wys from the output folder, deleting all updates and files; and then redistributing updates, the "replacement"-bug seems to be fixed, I can now update my application without any problems directly via the "wyUpdate.exe".The single instance problem when using the automatic updater backend still exists.

EDIT3: After several debug procedures I found out, that the closing is aborted and the update failed (occurs before the single instance error). The message is the same ("failed to connect to the newer wyUpdate.exe").After thinking a little bit and checking the website I noticed, that these arguments (from Point 6.) should be arguments for wyUpdate.exe and not for my software. Something is going wrong but I cannot found out the source of this call.

There's something in the way you're using the AutomaticUpdaterBackend that is wrong, but I don't know what it is without seeing the code. My guess is that on every start of your app you're calling ForceCheckForUpdates() -- you shouldn't do that. That can cause problem. Let the AutomaticUpdater checks for updates automatically (that's what it does).

But I really need to see your code before I can give you useful help.

Hm yes, I thought that I am using AutomaticUpdaterBackend the wrong way.And you are right, I am calling ForceCheckForUpdates() not only on the start but more often. I have a timer which checks with a given intervall (e.g. every hour; and for testing 1 minute).

This is the method to check for update(s): private void CheckForUpdate(double hoursBetweenChecks) { double hoursSinceLastCheck = (DateTime.Now - _auBackend.LastCheckDate).TotalHours;

if (hoursSinceLastCheck >= hoursBetweenChecks && _auBackend.UpdateStepOn == UpdateStepOn.Nothing) { _auBackend.ForceCheckForUpdate(); } }

My question is, how will the automatic updater check for updates? Is there a given time interval?How is it possible to install the new version nearly immediately (after 1 min, up to one hour) without using the ForceCheckForUpdates()?If I should not use the force method on startup, am I allowed to use this method after some time?

I will try it again to find out the problem and if I am not able to I would like to send you the code to have a look.Just to clarify, this is my idea of the updater:- I start my app, if there is a installation available then install- While the app is running, check regulary for updates and if found then download and extract but do not install- Before app closing and if there is an update available to install, the user will be asked if the update should be installed- Sometimes it is needed to force the update (if the device is not at the client right now and we are doing this ourselfs)

Some new findings:During the "single instance errors" i renamed wyUpdate.exe and then the errors stopped. It seems that wyUpdate is trying to start my application or similar things.

Today I was not able to fix the problem.It seems to occur after the first try to update. After i start my app again, the single instance problem occurs, as if the updater wants to start my application. Debugging the whole day to finally find nothing 😐

Tomorrow I will send you the sourcecode for the update module (just the important part) and hopefully you can find something (some wrong used code, ..).

Finally, I got rid of this problem.

This is what I did: I deleted the "C:/Users/username/wc/..." folder. Since then the single instance problem disappeared.I checked the "base..." - folder and found out that there was an older version of my software.

The second step what I did was to rewrite the update module and to change the setting from "CheckAndDownload" to "Automatic".The requirements are fulfilled (= finally working) now: Check, download and extract update in background; ask user before exit for update installation.

Installation is fast - except that one dll needs 5s to close.

To the ForceForUpdateChecks: I do this on startup (same as in your examples) and with a timer (e.g. each 10 min). Seems to work without problems.

One final question: How would one provide different clients different updates? So e.g. not the latest version but a previous one? Should I rewrite the "index.php" somehow?

One final question: How would one provide different clients different updates? So e.g. not the latest version but a previous one? Should I rewrite the "index.php" somehow?

Well, you would have to store the *.wys files in separate locations and somehow deliver that to the customer (based on a parameter you pass to index.php). But why would you want them on your latest version?