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

UnauthorizedAccessException when updating app, but powershell command works (in the same path) #717

Open
BoGnY opened this issue Oct 23, 2024 · 3 comments

Comments

@BoGnY
Copy link

BoGnY commented Oct 23, 2024

This is the app configuration:

AutoUpdater.RunUpdateAsAdmin = true;
AutoUpdater.Synchronous = true;
AutoUpdater.Mandatory = true;
AutoUpdater.UpdateMode = Mode.Forced;
AutoUpdater.DownloadPath = Application.StartupPath;
AutoUpdater.InstalledVersion = Assembly.GetExecutingAssembly().GetName().Version;

When trying to update automatically, I get System.UnauthorizedAccessException:
image

Log report:

mercoledì 23 ottobre 2024 17:45:19

ZipExtractor started with following command line arguments.
[0] c:\users\luca\desktop\it\zipextractor.exe
[1] --input
[2] c:\users\luca\desktop\it\codplayervpn.zip
[3] --output
[4] c:\users\luca\desktop\it
[5] --current-exe
[6] c:\users\luca\desktop\it\codplayervpn.exe

Waiting for application process to exit...
BackgroundWorker started successfully.
Found total of 1 files and folders inside the zip file.

System.UnauthorizedAccessException: Accesso al percorso negato.
   in ZipExtractor.FormMain.<>c__DisplayClass4_0.<FormMain_Shown>b__2(Object _, RunWorkerCompletedEventArgs eventArgs)

But running the same extraction command from powershell (in the same path), it works without problem:

image

mercoledì 23 ottobre 2024 17:54:23

ZipExtractor started with following command line arguments.
[0] c:\users\luca\desktop\it\zipextractor.exe
[1] --input
[2] c:\users\luca\desktop\it\codplayervpn.zip
[3] --output
[4] c:\users\luca\desktop\it
[5] --current-exe
[6] c:\users\luca\desktop\it\codplayervpn.exe

BackgroundWorker started successfully.
Found total of 1 files and folders inside the zip file.
Extracting CodPlayerVPN.exe [100%]
Successfully launched the updated application.
@ravibpatel
Copy link
Owner

Are you running the Powershell as admin too?

@BoGnY
Copy link
Author

BoGnY commented Oct 24, 2024

no, and it's very strange that with admin rights application get error, and with user rights powershell works 😖

@ravibpatel
Copy link
Owner

Maybe it's a file ownership issue? I have seen this type of issue when PC is reformatted. Files and Folders created by the previous OS user have still retained ownership of that user, which doesn't exist anymore on new installation. I usually solved it by going to security tab after going to properties of file and folder and adding and assigning rights to a new user.

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

2 participants