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 hanging and crashing when using progress #221

Open
stefanolson opened this issue Dec 1, 2013 · 6 comments
Open

UpdateManager hanging and crashing when using progress #221

stefanolson opened this issue Dec 1, 2013 · 6 comments

Comments

@stefanolson
Copy link

I've had a few the problems when running the update manager when the releases file cannot be found (no internet access etc...). The application hangs trying to download when it doesn't exist ONLY IF progress is set.

Sometimes, when I resize the application I get a crash saying that the update manager needs to be disposed, but the code hasn't finished running (I have a breakpoint on every possible exit + message boxes). Sometimes the application will crash with a web exception, with no stack trace. You can see from the log that it is trying to download it:
[INFO][2013-12-01T01:42:56] UpdateManager: Downloading RELEASES file from http://{website}/setup

But as it doesn't currently exist at that address it should just throw an exception or something (Which it does do if you don't pass progress). Sadly it just sits there and hangs - no exception, no nothing.

Running 0.7.4.

My code:

try
{
    using (var updateManager = new UpdateManager(Application.WebServer + "setup",
        "AppName", FrameworkVersion.Net45))
    {
        var progress = new Subject<int>();
        progress.Subscribe((p) => _value = p);

        await updateManager.CheckForUpdate(false,progress);

        MessageBox.Show("got there!");
    }
}
catch (Exception ex)
{
    MessageBox.Show("got ex!");
}
@anaisbetts
Copy link
Contributor

What happens if you enable first-chance exceptions?

@stefanolson
Copy link
Author

Still nothing, no exceptions at all :-(

@bgrainger
Copy link
Contributor

I can reproduce the crash by changing my update URL to https: (which I know will fail), and calling CheckForUpdate(false, progress) as per @stefanolson. (CheckForUpdate() with no progress will not crash.)

I've traced it to line 46 of BitsManager.cs. If I replace

ret.Select(_ => 100).Subscribe(progress);

with

progress.OnNext(100);

my app doesn't crash.

I'm guessing that ret.Select().Subscribe() propagates the captured WebExceptions, which eventually go unhandled?

Not sure if this is an actual bug in Squirrel, but @stefanolson can prevent the crash it by changing his code to

progress.Subscribe(p => _value = p, exception => { /* ignore */ });

@bgrainger
Copy link
Contributor

@stefanolson: Are you the same Stefan Olson who packaged up my Win32 splash screen? If so: small world, isn't it? (Also, your blog is currently down.)

@stefanolson
Copy link
Author

@bgrainger Yes, I am the same Stefan Olson! The WPF community is sadly very very small and with Microsoft's focus away from the desktop probably not going to get any bigger :-( WPF is just so much more flexible than WinRT or Windows phone which I'm doing most of my other work in these days. I feel like just about every project I work on you have to build for three or four different platforms and they are all Microsoft platforms, with substantial and frustrating differences!

Thanks for letting me know about my blog, I haven't done anything with it for ages. It's probably become overwhelmed with spam.

@stefanolson
Copy link
Author

@bgrainger thanks for the suggestion regarding the web exception. I will give that a go although most of the time I wasn't getting a web exception I was mostly just getting it hanging, but hopefully that will fix that as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants