Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.38k stars 1.03k forks source link

UpdateManger.CheckForUpdate freeze (acquireUpdateLock) #672

Open CrazyOrange opened 8 years ago

CrazyOrange commented 8 years ago

My var updateInfo = this.updateManager.CheckForUpdate();

call seems to freeze my application.

I've added some Logger output into acquireUpdateLock. It actually completes the Task.Run part but it seems that it won't return a value = freeze.

When I'm stepping through the function it does work. Maybe a timing issue or am I missing something?

pablopedrosa commented 7 years ago

I had the same problem, and after downloading the code, I saw that the method acquireUpdateLock had an error. Whitout analyzing everithing in detail, I made this changes in order to work. Change the Sign of the method to: IDisposable acquireUpdateLock() Delete the Task.Run: return Task.Run(() => { So the method will run in the same thread, and will return to the same thread the IDisposable Object. After that I had to delete the "await" to all the calls to acquireUpdateLock (because is already synchronous). That solve the problem for me.

Hope that can be the definitive solution. Regards. Pablo Pedrosa

chldbwnstm commented 5 years ago

I had the same problem, and after downloading the code, I saw that the method acquireUpdateLock had an error. Whitout analyzing everithing in detail, I made this changes in order to work. Change the Sign of the method to: IDisposable acquireUpdateLock() Delete the Task.Run: return Task.Run(() => { So the method will run in the same thread, and will return to the same thread the IDisposable Object. After that I had to delete the "await" to all the calls to acquireUpdateLock (because is already synchronous). That solve the problem for me.

Hope that can be the definitive solution. Regards. Pablo Pedrosa

It seems that you have made this to work. Can you please adjust to how I can make this code work? I cannot understand your reply.

public login() { InitializeComponent(); AddVersionNumber(); CheckForUpdates(); }

    private async Task CheckForUpdates() //Squirrel Check Update
    {
        using (var manager = UpdateManager.GitHubUpdateManager("https://github.com/chldbwnstm/qbeeeoskoreaupdate"))
        {
            await manager.Result.UpdateApp();
        }
    }