Using Squirrel.Windows, I wanted to handle the update process in the Application Exit handler of my WPF application using this code:
Task.Run(async () =>
{
using (var mgr = new UpdateManager(Settings.Default.UpdatePath))
{
var release = await mgr.UpdateApp();
if (release != null && release.Version > Assembly.GetEntryAssembly().GetName().Version)
{
MessageBox.Show("Update applied");
}
}
});
This code works if I call it on startup, or on an event handler during execution, but not inside the Application Exit event handler defined like this:
app.xaml:
<Application
...
Exit="Application_Exit"
...
app.xaml.cs:
void Application_Exit(object sender, ExitEventArgs e)
{
...
}
Is it a limitation of Squirrel.Windows? Or is there something special to do to use the code presented in the Application Exit event handler?