Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateManager.GitHubUpdateManager() completely freezes Application #1422

Open
johanneszellinger opened this issue Nov 24, 2018 · 13 comments
Open
Labels
bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem

Comments

@johanneszellinger
Copy link

johanneszellinger commented Nov 24, 2018

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...

@johanneszellinger johanneszellinger changed the title UpdateManager.GitHubUpdateManager() completeley freezes Application UpdateManager.GitHubUpdateManager() completely freezes Application Nov 24, 2018
@DatalyticUk
Copy link

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.

@ArsenAghajanyan
Copy link

I'm facing the same issue. The application gets completely frozen awaiting the Result.

@johanneszellinger
Copy link
Author

johanneszellinger commented Dec 1, 2018

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.

@ArsenAghajanyan
Copy link

The GitHubUpdateManager part works just fine as far as I tried to debug. Something happens afterwards, which I was not able to spot.

@patrickklaeren
Copy link

Is this still an issue?

@shiftkey shiftkey added the bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem label Apr 24, 2019
@johanneszellinger
Copy link
Author

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.

@gojanpaolo
Copy link
Contributor

@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);
                }
            }

@Christoph1972
Copy link

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?

@imSalBukhari
Copy link

Exactly same problem. No clue how to get it working...

@lightlike
Copy link

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.

@imSalBukhari
Copy link

@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

@lightlike
Copy link

  • 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.

@18520339
Copy link

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();
        /* ... */
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem
Projects
None yet
Development

No branches or pull requests

10 participants