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 on PackageManager.AddPackageAsync #615

Open
ironhide91 opened this issue Feb 11, 2024 · 0 comments
Open

UnauthorizedAccessException on PackageManager.AddPackageAsync #615

ironhide91 opened this issue Feb 11, 2024 · 0 comments
Labels
Area-External The issue relates to something outside this repo Area-MSIX General MSIX issues

Comments

@ironhide91
Copy link

Project
MSIX SDK

Describe the bug
PackageManager.AddPackageAsync fails with exception :

System.UnauthorizedAccessException
  HResult=0x80070005
  Message=Attempted to perform an unauthorized operation.
  Source=WinRT.Runtime
  StackTrace:
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)
   at ABI.Windows.Management.Deployment.IPackageManagerMethods.AddPackageAsync(IObjectReference _obj, Uri packageUri, IEnumerable`1 dependencyPackageUris, DeploymentOptions deploymentOptions)
   at Windows.Management.Deployment.PackageManager.AddPackageAsync(Uri packageUri, IEnumerable`1 dependencyPackageUris, DeploymentOptions deploymentOptions)
   at TenetQKato.AutoFile.Updater.UpdateTask.Run(PackageManager packageManager, Uri file) in C:\tenet\tenetqkato\TenetQKato\TenetQKato.AutoFile.Updater\UpdateTask.cs:line 18
   at TenetQKato.AutoFile.Updater.Updater.<RunAsync>d__2.MoveNext() in C:\tenet\tenetqkato\TenetQKato\TenetQKato.AutoFile.Updater\Updater.cs:line 35

From Debug :

Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: WinRT originate error - 0x80004005 : ''TenetQKato.AutoFile' violates pattern constraint of '\bms-resource:.{1,256}'.'.
Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: 0xE0000001 (parameters: 0xFFFFFFFF80004005).
Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: WinRT originate error - 0x80004005 : ''TENET Enterprises' violates pattern constraint of '\bms-resource:.{1,256}'.'.
Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: 0xE0000001 (parameters: 0xFFFFFFFF80004005).
Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: WinRT originate error - 0x80004005 : ''TenetQKato.AutoFile' violates pattern constraint of '\bms-resource:.{1,256}'.'.
Exception thrown at 0x00007FFC456BCF19 (KernelBase.dll) in App.exe: 0xE0000001 (parameters: 0xFFFFFFFF80004005).
onecore\printscan\appxpackaging\blockmap\src\appxblockmapreader.cpp(517)\AppxPackaging.dll!00007FFB6D11F943: (caller: 00007FFB6D11F3D6) ReturnHr(2) tid(3fec) 80070002 The system cannot find the file specified.
    Msg:[Filename: AppxContentGroupMap.xml] 
onecore\admin\appmodel\packagemanager\client\client.cpp(2755)\AppXDeploymentClient.dll!00007FFC3F5B14BC: (caller: 00007FFC3F5D7897) ReturnHr(1) tid(3fec) 80070005 Access is denied.
onecore\admin\appmodel\packagemanager\client\client.cpp(91)\AppXDeploymentClient.dll!00007FFC3F5D78E8: (caller: 00007FFB8F189716) ReturnHr(2) tid(3fec) 80070005 Access is denied.
Exception thrown: 'System.UnauthorizedAccessException' in WinRT.Runtime.dll

This msix package is created from .net 7.0 console application using "Windows Application Packaging Project" template.

This app is companion app that get installed from the main app which is a WinUI3 application.
The code to install/updates resides in a separate class library.
This class library is referenced in the main app.

It works when I reference this class library in a console project and call the code that eventually calls PackageManager.AddPackageAsync.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue needs to be triaged by a member of the core team label Feb 11, 2024
@msftrubengu msftrubengu added Area-MSIX General MSIX issues Area-External The issue relates to something outside this repo and removed Needs-Triage Issue needs to be triaged by a member of the core team labels Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-External The issue relates to something outside this repo Area-MSIX General MSIX issues
Projects
None yet
Development

No branches or pull requests

2 participants