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

an exception occured during a WebClient request #141

Closed
AlaHamad opened this issue May 3, 2018 · 5 comments
Closed

an exception occured during a WebClient request #141

AlaHamad opened this issue May 3, 2018 · 5 comments
Labels

Comments

@AlaHamad
Copy link

AlaHamad commented May 3, 2018

I get an error after it downloads the update zip file

image

@ravibpatel
Copy link
Owner

@AlaHamad Can you give me URL of your XML file?

@VLorz
Copy link
Contributor

VLorz commented May 4, 2018

Same happends to me when I specify the location for downloading the .zip file using
AutoUpdater.DownloadPath = <my_local_path>;

The path <my_local_path> points to one location where the current user has read/write rights without administrative privileges. I also made sure the full path exists.

When I don't specify the download path the behaviour is different, but also in error. The auto-updater is capable of downloading the .zip file, but an error window pops up showing a System.UnauthorizedAcessException with message:

Access to the path 'C:\users\my_user_name\AppData\Local\Temp\my_zip_filename.zip' is denied

update: The error occurs in function WebClientOnDownloadFileCompleted, from class DownloadUpdateDialog, in line 99 when it tries to remove a previously downloaded file using File.Delete(tempPath);. If I remove the file manually, code execution continues as normal, but then ZipExtractor hangs.

zipextractor_hang

It works OK when the update file is an executable installer.
update: The System.UnauthorizedAcessException exception was originated by file access permissions set while running the application under privileged user, cancelling the update, then running the application again under non-privileged user account. After manual erase it all worked OK for me.
The System.Net.WebException is rised whenever you specify the AutoUpdater.DownloadPath.
One more thing I made was downloading the code and recompiling it altogether and replacing the ZipExtractor.exe in the resources of the AutoUpdater project, prior to that I was using the Nuget package. After this the ZipExtractor started working OK, no more hangings so far.

Regards

@ravibpatel
Copy link
Owner

@VLorz It works when you specify the path using AutoUpdater.DownloadPath?

@VLorz
Copy link
Contributor

VLorz commented May 7, 2018

@ravibpatel, I've added an update to my previous comment.
Thanks a lot for sharing this work. Best regards.

@VLorz
Copy link
Contributor

VLorz commented May 7, 2018

@ravibpatel, I've traced down the System.Net.WebException exception on my system, this time it was rised because the path for the download did not exist. This of course contradicts my first comment.

One possibly appropriated point for ensuring that the download path exits is in file DownloadUpdateDialog.cs, before the call to _webClient.DownloadFileAsync(uri, _tempFile);, in line 45. This code did the trick for me:

if (!Directory.Exists( Path.GetDirectoryName( _tempFile ) ))
                Directory.CreateDirectory( Path.GetDirectoryName( _tempFile ) );

Regards

@ravibpatel ravibpatel added the bug label May 16, 2018
@ravibpatel ravibpatel added this to the v1.4.10 milestone May 16, 2018
JavierCanon pushed a commit to JavierCanon/AutoUpdater.NET that referenced this issue Aug 5, 2018
…ied using DownloadPath property doesn't exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants