Update ended before the current update step...

I am getting the error "Update ended before the current update step could be completed". I searched this site and found a suggestion that the location of wyupdate.exe file (which I have renamed and customized just to change the messages from wyupdate to my application name) needs to be in the same directory as the application, which it is.

I am using the exact same customized wyupdate on a different release of my project and it works fine - I don't get this error. Is there a log file or something I can look at to determine what is failing? It does not always fail in the same place. Sometimes it fails as the application is re-starting, which then breaks my application. Sometimes it fails after the application appears to have started successfully and then everything seems to work (although I have not tried to check for an update after that).

Any suggestions would be appreciated.

Did you set the wyUpdateLocation property in the AutomaticUpdater?

Are you calling ForceCheckForUpdate() on every start of your app? (if so: don't).

My wyUpdateLocation = "myUpdater.exe", which is located in my application directory, so it is in the same place as my application executable.

I call ForceCheckForUpdate under 2 conditions - when the user clicks a button to request it and if they have automatic updates turned on. It is not called automatically when the application starts by default. In my current testing, I click the button to check for updates, which is where I call ForceCheckForUpdate.

As I mentioned earlier, I have cloned my application to create a different version (the original uses access and the new one uses sql server). The original version works fine - I have no problem with it. I created a new wyp database for the new one. The application code (in regards to the auto updates) are identical.

Is there nothing else that can cause this error? I thought I have seen it work once or twice without the error, but I get the error more than not.

I have also been successful at running the myUpdater.exe file directly and it has worked consistently - no error. I guess that points to something in the application - but as I said the other version works fine. I wonder if there is some sort of timing issue when I run it through the application since sometimes it works, sometimes it blows up early after opening the application, and other times it blows up later after opening the application (which gives an error but seems fine).

As I mentioned earlier, I have cloned my application to create a different version (the original uses access and the new one uses sql server). The original version works fine - I have no problem with it. I created a new wyp database for the new one. The application code (in regards to the auto updates) are identical.

If you're using separate wyBuild projects, then you should also use separate GUIDs; both for wyUpdate (in File -> Properties ->wyUpdate) and for the AutomaticUpdater (the GUID property).

My wyUpdateLocation = "myUpdater.exe", which is located in my application directory, so it is in the same place as my application executable.

You should always use absolute paths when you can. (Relative paths cause problems -- namely you're using where the user started the app from, not the actual directory).

I put in the full path and it did not change anything - I still get the error.

I also changed the GUID and that did not correct the problem either.

What else could be causing this? Does it matter that I changed around some of the files in the 1.0 update structure with my 1.1 structure? I mean I moved some files from one directory to another (they were in the wrong place) and removed some files that should not be updated. Does changing the "history" affect anything?

Another observation is that it appears that it may have something to do with timing. In some cases it does not error out. When it does not, it appears that the application takes a bit longer to restart after the updates. When it fails, the application restarts fairly quickly. I also have 2 environments that I am testing on. The first is what I would call a "normal" environment, while the second is configured with IA-type controls and permissions. It seems to fail less on the "normal" environment (but it still fails) while it always fails on the IA environment.

It's almost certainly because you're calling ForceCheckForUpdate() on every startup. If you show me a snippet of the startup code I'll tell you what's wrong.

I call ForceCheckForUpdate under one of 2 conditions. The first one is when the user clicks the check for updates button: Private Sub btnCheckForUpdates_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCheckForUpdates.Click _winMain.bShowLatestMessage = true _winMain.Cursor = Cursors.WaitCursor 'force this flag to make sure the updates check properly _winMain.bFirst = True 'debug MsgBox ("Before auto update call in button click") _winMain.AutomaticUpdater1.ForceCheckForUpdate(true) 'save the settings then close UpdateValue() Me.close End Sub

I don't see the message box in this code so I know it is not accidentally getting called in this event.

The second is if they have a flag set to check for updates on startup. In the code below, the call "GetAutoUpdate" checks the database for the value of the user's setting to see if they have indicated to check for updates on startup. I see that the AU value is 2 and I do not get the message before the ForceCheckForUpdate call, so I know it is not being called. If the user has indicated they want to check on startup, I have the following code in the load event of my main form: AU = GetAutoUpdate() 'debug MsgBox ("AutoUpdate is " & AU) If AU = 4 then bFirst = true if Not AutomaticUpdater1.ClosingForInstall then MsgBox ("Before updater call") dim b As Boolean =AutomaticUpdater1.ForceCheckForUpdate(true) End If NotifyIcon1.Icon = New Icon("globe.ico") NotifyIcon1.Text = "Downloading Updates " NotifyIcon1.Visible = false end if

So if we aren't supposed to call ForceCheckForUpdate on every startup, what do we do when the user wants the application to check for it when they open the application?

Also maybe I am not explaining this error properly. I get this after the updates are downloaded and installed and after the application restarts. As I have said before this code is identical to the other version of this application and it works just fine. I know I must have something wrong in my wyp file but I have no idea what....

if Not AutomaticUpdater1.ClosingForInstall thenMsgBox ("Before updater call")dim b As Boolean =AutomaticUpdater1.ForceCheckForUpdate(true)End If

Yeah, this is wrong. If there's a pending update then this call will cause wyUpdate to exit prematurely.

So if we aren't supposed to call ForceCheckForUpdate on every startup, what do we do when the user wants the application to check for it when they open the application?

Honestly, let the AutomaticUpdater handle it. That's its job. Just set the DaysBetweenChecks property.

OK - but since my application is not calling this, what can I do to get my update to work without the error? I am getting down to the wire for my release and I really need to figure this out!

I am still trying to figure out what is wrong, but I do have a question regarding DaysBetweenChecks. I give the user the option of either the autoupdater checking for updates or they can click a button forcing the app to call ForceCheckForUpdate and I save off their choice in a database. If I look at the database on application start and they want to automatically check updates, the default of DaysBetweenChecks is 0, so then I change it to 1. But that is only good for the time the application is running, correct? Or if I change it will it go out and look for updates then?

The more I try things to figure out what is wrong the more I think this may be a timing issue, since it works randomly (but fails more than works).

Is there some way to delay either the restart the application until after the updater is done or delay the updater processing until after the application restarts? Is that what the WaitBeforeCheckSecs property does?

Set DaysBetweenChecks in the constructor of you main form.

The more I try things to figure out what is wrong the more I think this may be a timing issue, since it works randomly (but fails more than works).

What function are you calling that give you this? If the AutomaticUpdater already has pending updates and you call ForceCheckForUpdate() then errors will happen (because you're not supposed to just blindly call that function).

Is that what the WaitBeforeCheckSecs property does?

No. That's to delay checking X number of seconds after the application has started.

Let me try to explain in a bit more detail what is happening.

The user clicks a button that checks for updates, where I call ForceCheckForUpdate. (I do not call ForceCheckforUpdate automatically). The updater sees the changes and I post a message that when the user says they want to update I then download the update in the background. When the update is downloaded, I post a message that says when then start the application again the update will be installed. All this is fine.

The user then closes the application and re-opens it. The updater then starts and goes through the steps of installing the update, including running a file that I have in the Temporary file folder and indicate through the wyp file to run after the install. This file runs and the application is closed. This is when I have issues.

Sometimes the application will start back up and be fine. Other times I get the "Update ended" message right away, putting my application in a bad state where it no longer runs and is corrupt. Other times it starts the application and sometime after it successfully starts I get the "Update ended" message. However, the application is fine and runs normally after that. I can even click the check for update button and it tells me I have the most recent version.

I can't figure out any pattern as to when the application restart works fine or when I get the errors. I get the error more that not and when I do get it, I can't determine why sometimes I get it earlier than other times.

When the application starts I am NOT calling ForceCheckForUpdate automatically. The user must request it. I don't think there is any particular function I am calling since the error occurs in different parts of the application restarting (or it does not error at all).

If you're not using the latest version of the AutomaticUpdater and wyUpdate, then do that first. Then try again.

If you're still getting errors, then you'll need to make a small reproducible example project for us to work with because we can reproduce the error you're getting.

I am using AutomaticUpdater 2.6.18.4 and I modified wyUpdate version 2.6.18.0 to use my application title instead of wyUpdate (only change I made). I believe these are the current versions, correct?

I will try to make a small version of my application for you to test with, but it will have to use SQL Server Express, since the version of my application that uses Access does not get the error.

Another question - what process starts the application back up after the update is done? If I can modify that I may try to put a sleep in to delay the start until the update completes whatever it is doing that is causing the error.

I am trying to figure out why sql server would cause a difference. Have you ever tested the update process with an application that uses sql server? I wonder if somehow the pipes may be causing a conflict (maybe sql server and wyupdate are using the same one)?

Is there a way to prevent the updater from restarting the application after the updates are complete? If that keeps me from getting the error it may not be optimal but it may allow me to get the release out until I can correct the update error.

My other thought is to kick off the updater through a command line since it seems to run fine in stand-alone mode, however, I must be doing something wrong in my application because wyupdate does not seem to run with either a shell command or process.start command.

But I would prefer some help/advice to get the updater working the way it is intended!

Another question - what process starts the application back up after the update is done?

The updater: wyUpdate.

I wonder if somehow the pipes may be causing a conflict (maybe sql server and wyupdate are using the same one)?

No. It sounds like you're starting an executable as part of your update, but you forgot to check the "wait for process to exit before continue". Make sure you check that. Rebuild your update. Reupload them to your servers.

Yes, I am running an executable "after updating is complete". But do have the "wait for process to exit before continue" box checked. I am also running the executable as Elevated since it needs that to do the sql server processes it performs.

As I have said before, this error is also random when it happens. I would think if I did not have these settings correct it would never work.

Any other suggestions? I am not allowed to send you the source code and right now I don't have the time to develop a small sql server based app for you do try.

Have you ever tested the update processes with an application that uses sql server?

I don't think this has anything to do with SQL server. But no, we can't reproduce this. If you can't reproduce it, then you might just consider using wyUpdate as a standalone updater and don't use the AutomaticUpdater.

Wyatt wrote:>

if Not AutomaticUpdater1.ClosingForInstall then> MsgBox ("Before updater call")> dim b As Boolean =AutomaticUpdater1.ForceCheckForUpdate(true)> End If

> > Yeah, this is wrong. If there's a pending update then this call will cause> wyUpdate to exit prematurely.

.. If he checked UpdateStepOn != UpdateStepOn.Nothing as well as Not ClosingForInstall, would this be sufficient in checking whether there is a pending update? If not, can you please advise how best to check for a pending update before calling ForceCheckForUpdate?

Ideally you don't call ForceCheckForUpdate() at all. Let the AutomaticUpdater call it -- that's what it does.

But yes, if you also ensure UpdateStepOn != UpdateStepOn.Nothing, then that should work.