AutomaticUpdaterWPF Update Fails

Hi there. I love the simplicity of wyUpdate and I have been using it for a while now, but unfortunately with limited success. Here is the scenario...

When i first implemented wyUpdate in my WPF app, it downloaded the update fine and when the application was restarted the update process started but my app also continued to start and then would crash since the update was being applied...annoying for sure, but not catastrophic.

I made a few changes to fix that issue, but now after the update is downloaded and the application is restarted what happens is that the application starts briefly (1s in the task bar) and then it just closes, and the application never starts again. What's even more confusing is that when i uninstall the app and then reinstall from scratch it doesnt fix the issue, the application will continue to fail to start. In order to get things working again I have to uninstall, then install a much older version, and then manually run wyUpdate.exe from the folder and then it successfully updates.

I'm guessing (hoping) that i'm just not quite doing something write in the 'check for updates' or 'closing' process? Below is my code:

public MainWindow() { InitializeComponent(); // set the check for updates menu automaticUpdater1.MenuItem = mnuCheckForUpdates; automaticUpdater1.ClosingAborted += automaticUpdater_ClosingAborted;

// only load files, etc. when NOT closing to install an update if (!automaticUpdater1.ClosingForInstall) { // load important files, etc. this.Loaded += Window_Loaded; } else { Environment.Exit(1); } }

/// <summary> /// if the closing aborted, then load the window up /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void automaticUpdater_ClosingAborted(object sender, EventArgs e) { this.Loaded += Window_Loaded; }

/// <summary> /// Create data bindings, etc /// </summary> void Window_Loaded(object sender, RoutedEventArgs e) { parameters = new Params(); // create params base.DataContext = parameters; // bind datacontext cbSlots.ItemsSource = null; // set items source for dropdown

// Check for updates on start up automaticUpdater1.ForceCheckForUpdate(); }

What version of wyUpdate.exe and the AutomaticUpdater.dll are you using? Right click, click properties, then click the Details tab to view the version.

Also, this code is wrong:

// only load files, etc. when NOT closing to install an updateif (!automaticUpdater1.ClosingForInstall){// load important files, etc.this.Loaded += Window_Loaded;}else{Environment.Exit(1);}

Don't call Environment.Exit(). Let the AutomaticUpdater close your app when it's ready to. My guess is that's the problem.

Hi Wyatt,Thanks for the super fast response. I have removed that piece and will try it out shortly. I was using AutoUpdaterWPF 2.6.18.0, but just updated to 2.6.18.4 today. I also think that the .NET 3.0 version might have been referenced previously, but not updated correctly to the .NET 4.0 version when i updated the whole project a few weeks ago, so i have fixed that as well.

I'll test with the exit code removed and reply with an update shortly. Thanks!