Squirrel.Windows
Squirrel.Windows copied to clipboard
UpdateManager.GitHubUpdateManager() completely freezes Application
I call the following Method in my UpdateCheckManager
class after a usercontrol load event:
public static class UpdateCheckManager
{
#region Public Methods
public static async Task CheckForUpdates(IProgress<string> progressReport)
{
//wait for 2 sekonds, so GUI shows up and works.
await Task.Delay(2000);
using (var mgr = UpdateManager.GitHubUpdateManager(GenDefString.RepositoryLink))
{
progressReport.Report(GenDefString.CheckingForUpdates);
try
{
var updateinfo = await mgr.Result.CheckForUpdate();
Console.WriteLine("done");
....
}
catch(Exception e)
{
System.Windows.MessageBox.Show(e.Message);
}
}
}
#endregion
}
My application completely freezes as soon as it reaches the line
var updateinfo = await mgr.Result.CheckForUpdate();
I do not get any kind of exception thrown. The App just becomes unresponsive and I have to kill it externally. (However not showing the "not responding" message in the title bar)
The link saved in GenDefString.RepositoryLink is the following:
public const string RepositoryLink = @"https://github.com/myuser/myapp";
(with "myuser" and "myapp" replaced by my actual username and repository name of course)
I know that the CheckForUpdated() won't work while debugging in VS, however shouldn't it instead of completely crashing give me some feedback what went wrong, that I can implement?
My plan was to implement a few different results from this method, which the user gets from the progressReport:
- "Checking for updates..."
- "Checking for updates failed!"
- "Found and installed new update. A restart of the application is needed to apply updated. "
- "Currently running the latest version. "
I'm a bit lost on how to debug this error...
I have just started trying to integrate squirrel and have reached the same problem. In my case there are two issues. The first is that if you step through the GitHubUpdateManager code the json returned is not parsed correctly. Secondly, the update manager created does not allow token keys.
Why won't CheckForUpdate work while debugging?
You are probably not seeing any errors with the message box as you are running async so by the time its finished you don't know if you have a display or what is controlling it.
I'm facing the same issue. The application gets completely frozen awaiting the Result.
Why won't CheckForUpdate work while debugging?
Actually, I do get why this wouldn't work, as the whole file setup is different from the deployed app. However, the app freezes completely (even though the update process runs on it's own task), which I don't get. Also I would like to have some sort of feedback, where the problem lies (exception), since the update process also doesn't work on the deployed exe.
The GitHubUpdateManager part works just fine as far as I tried to debug. Something happens afterwards, which I was not able to spot.
Is this still an issue?
Omitted the update functionality in my last project after this issue and haven't tested it in a while. I probably will have a new project in the future where I can test this again.
@TheRealRolandDeschain have you tried disposing the UpdateManager.GithubManager.Result
? There's pending PR #1396 which should update the docs. Meaning your code should look like this
using (var mgr = UpdateManager.GitHubUpdateManager(GenDefString.RepositoryLink))
{
progressReport.Report(GenDefString.CheckingForUpdates);
try
{
using (var result = await mgr.Result)
{
var updateinfo = result.CheckForUpdate();
Console.WriteLine("done");
...
}
}
catch(Exception e)
{
System.Windows.MessageBox.Show(e.Message);
}
}
I have the same problem.
Using(var result = await mgr.Result) doesn’t work, because Result is not awaitable. What references are required to get the extension method?
Exactly same problem. No clue how to get it working...
I had the same problem I solved it using this. Try looking at that.
If you use the GithubUpdateManager
you get back a Task but you need to dispose of the UpdateManager to not get an Error at some point. As @gojanpaolo said.
You cannot test anything with normal debugging, because Squirrel is searching for the Update.exe in the parent directory which does not exist while debugging. Try releasifying and test it there with logging or connect to the process with Visual Studio.
@lightlike yes i have tried doing what @gojanpaolo has mentioned, but didn't any response. The application freezes completely and there is no exception to catch and sort out what is going on behind the scenes.
Today I also tried the way you have mentioned, but still facing the same issue. The code is working fine for local updates, but the whole application just freezes while having updates from github when the debugger hits
Squirrel.UpdateManager.GitHubUpdateManager(GitHubUpdatePath).Result
And yes the release i'm trying to update from is marked LATEST by GitHub
- Could it be that your project is in any form private or behind an authentication? (I don't think that will work)
- Do you have the correct Github link?
- What version are you using? (mine is 1.9.1)
- Try running it in a seperate Task. (it might take a minute to find the release)
- Did you include all files in the release? ("RELEASES", *.nupkg)
- Are you going up in version numbers or down?
- ...
This seems to be quite a special problem. I had to try this over the time of a few weeks to get mine running. You've got my code. If you want, you can copy that. Try some different stuff.
In my case, I tried to put an await
before UpdateManager
and everything worked. Hope this helps.
using (var manager = await UpdateManager.GitHubUpdateManager(url))
{
ReleaseEntry releaseEntry = await manager.UpdateApp();
/* ... */
}