WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Starting with v1.1.4, bootstrapper fails for unpacked apps with 'access is denied'

Open fredemmott opened this issue 2 years ago • 19 comments

Describe the bug

Once the runtime is upgraded from v1.1.3 to v1.1.4, unpackaged apps (built with either v1.1.3 or v1.1.4 SDK) fail with:

D:\a\_work\1\s\dev\WindowsAppRuntime_BootstrapDLL\MddBootstrap.cpp(373)\Microsoft.WindowsAppRuntime.Bootstrap.dll!00007FFD265B8AE7: (caller: 00007FFD265B779A) Exception(1) tid(2780) 80070005 Access is denied.
    Msg:[Error in LoadLibrary: 5 (0x5) loading C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.WindowsAppRuntime.dll] CallContext:[\Initialize] 

This happens regardless of if the runtime was installed via the MS store, or from the redistributable.

Steps to reproduce the bug

Download and build https://github.com/OpenKneeboard/OpenKneeboard at f25d16439d6f5f5a967846de3608f31853785aba

Try to run the exe

Expected behavior

Bootstrapper loads the runtime libraries

Screenshots

No response

NuGet package version

1.1.4

Packaging type

Unpackaged

Windows version

Windows 10 version 21H2 (19044, November 2021 Update)

IDE

Other

Additional context

The same app works fine with the v1.1.3 runtime, or when packaged.

I'm able to open the DLL in other programs, e.g. DependenciesGui

Downgrading to v1.1.3 fixes the issue.

IDE: VSCode

fredemmott avatar Aug 27 '22 19:08 fredemmott

https://task.ms/41120526

btueffers avatar Aug 29 '22 19:08 btueffers

As a workaround, is there any way I can get Windows/the store to stop automatically updating me from 1.1.3 to the broken version? I have no packages installed that depend on the windows app runtime.

fredemmott avatar Sep 01 '22 00:09 fredemmott

Does this happen when you install WinAppSDK runtime 1.1.4 as the 1st/only WinAppSDK packages on the machine? When 1.1.3 is installed and you update to 1.1.4?

There's an odd ACL issue that might be the culprit here. Please run

icacls "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.WindowsAppRuntime.dll"

and share the result. And if you also have 1.1.3 installed please do that same for that too.

DrusTheAxe avatar Sep 01 '22 21:09 DrusTheAxe

Okie, so starting with get-appxpackage -name '*AppRuntime*' | remove-appxpackage:

  1. installing 1.1.3 from installer at https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads
  2. all is good
  3. windows automatically upgrades to 1.1.4 - 1.1.3 is still partially installed: https://gist.github.com/fredemmott/f00b0e2cb401cbc99adf9424c60bc371
  4. MSIX package still launches
  5. unpackaged exe fails with 'access is denied'
  • can open in dependenciesgui
  • acls: https://gist.github.com/fredemmott/a2c1eec04f4b77be69ef7f5155149ab7
  1. get-appxpackage -name '*AppRuntime*' | remove-appxpackage
  2. install 1.1.4 from installer at https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads; 1.1.3 is not installed at all
  3. MSIX package still launches
  4. unpackaged exe fails with 'access is denied'
  • ACLs: https://gist.github.com/fredemmott/76c8e42023f1a93b93e5333a30d8588d
  1. get-appxpackage -name '*AppRuntime*' | remove-appxpackage
  2. install 1.1.3 again
  3. all good, msix and standalone
  4. acls: https://gist.github.com/fredemmott/f31b3421972b75f023c0131d330bd249

fredemmott avatar Sep 02 '22 03:09 fredemmott

Not used to reading this, but sounds likely related:

  • v1.1.3: BUILTIN\Users:(I)(RX)
  • v1.1.4: BUILTIN\Users:(R)

fredemmott avatar Sep 02 '22 03:09 fredemmott

Having the same issue with my unpackaged app and 1.1.4. It works after I grant RX permission to the DLLs but they get randomly reset

m2jean avatar Sep 03 '22 17:09 m2jean

I have the same problem with unpackaged apps and SDK v1.1.4. Debugging in Visual Studio 2022 does not work anymore either, then the error code appears: The program "[15828] TestProg.exe" was terminated with code 2147942405 (0x80070005).

DFX-Coding avatar Sep 03 '22 17:09 DFX-Coding

  • v1.1.3: BUILTIN\Users:(I)(RX)
  • v1.1.4: BUILTIN\Users:(R)

That is extremely interesting. Do you know the repro to produce this? Would this be in the above 13 steps as steps 3.5 run ICACLS on 1.1.3 and 7.5 run ICACLS on 1.1.4 ?

DrusTheAxe avatar Sep 07 '22 17:09 DrusTheAxe

Yep, it's the above steps for me; BUILTIN\Users:(R) (1.1.4) on steps 5 and 9, BUILTIN\Users:(I)(RX) (1.1.3) on step BUILTIN\Users:(I)(RX) , both within the full ACLs in the linked gists

fredemmott avatar Sep 07 '22 17:09 fredemmott

Checking just the ACLs:

1.1.3

  1. Download the 1.1.3 x64 exe installer from https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads
  2. Run once downloaded
  3. Check ACLs (icacls "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1003.565.600.0_x86__8wekyb3d8bbwe\Microsoft.WindowsAppRuntime.dll"), see BUILTIN\Users:(I)(RX)

1.1.3 -> 1.1.4

  1. Download the 1.1.4 x64 exe installer from the same location
  2. run once downloaded
  3. Check ACLs (icacls "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.WindowsAppRuntime.dll")
    • on a clean hyper-v VM running 19044.1288), see BUILTIN\Users:(I)(RX)
    • on my day to day machine (version 19044.1889, installed january, developer mode enabled, Visual Studio 2019 and 2022 installed), see BUILTIN\Users:(I)(R)

fredemmott avatar Sep 07 '22 17:09 fredemmott

image

Left side: my day to day machine Right side: VM

Differences on right side:

  • has 'integrity level' below 'owner'
  • has 'Inherited from' -> "parent Object' instead of 'None'
  • only has one 'Users' entry, not 4

fredemmott avatar Sep 07 '22 17:09 fredemmott

1.1.3

... 3. Check ACLs (icacls "...x86..."), see BUILTIN\Users:(I)(RX)

x86 but the 1.1.4 ICACLs is for x64. Wrong path? (but same result?)

DrusTheAxe avatar Sep 07 '22 20:09 DrusTheAxe

only has one 'Users' entry, not 4

And notice the last 2 Users have Conditional ACEs(?) for Microsoft.WindowsAppRuntime and YourPhone?

YourPhone is a packaged app using WinAppSDK but I wouldn't expect YourPhone (or any other package) in the ACL for a framework package. Tapping some other Windows folks about this

DrusTheAxe avatar Sep 07 '22 20:09 DrusTheAxe

Sorry, yep, wrong path and same results. Interestingly, if I install all mandatory and recommended windows updates in my hyper-v VM (taking me from 19044.1288 to 19044.1889) I can reproduce the R vs RX ACL difference in my VM (RX on 1288, R on 1889), just by installing the v1.1.4 exe

fredemmott avatar Sep 07 '22 20:09 fredemmott

Ditto (R + conditional ACLs, not RX), on .1889 and also if I install the optional '2022-08 Cumulative Update Preview for Windows 10 Version 21H2 for x64-based Systems (KB5016688)' to get me to .1949 before installing the windows app runtime

image

fredemmott avatar Sep 08 '22 00:09 fredemmott

On a tangent, self-contained isn't a viable workaround due to https://github.com/microsoft/microsoft-ui-xaml/issues/7281

fredemmott avatar Sep 08 '22 15:09 fredemmott

if I install all mandatory and recommended windows updates in my hyper-v VM (taking me from 19044.1228 to 19044.1889) I can reproduce the R vs RX ACL difference in my VM (RX on 1228, R on 1889), just by installing the v1.1.4 exe

If you don't apply any windows updates but otherwise same order of operations does 1.1.4 wind up with RX or R?

DrusTheAxe avatar Sep 08 '22 18:09 DrusTheAxe

No updates, v1.1.4 exe on 19044.1288, I get RX

Edit: corrected '1228' to '1288'

fredemmott avatar Sep 08 '22 18:09 fredemmott

With the Windows App SDK 1.2 Preview 1 the problem does not occur and all unpackaged apps work as they should.

DFX-Coding avatar Sep 14 '22 15:09 DFX-Coding

I have this issue using the 1.2.x variants of the SDK. It only seems to happen on Windows 10 (and upgrade to 11 and the problem goes away). The Windows 10 machines were fully up to date. Downgrading the Win10 machines to v1.1.3 of the SDK allowed them to work as well but any newer version caused the issue.

brent-schmidtbauer avatar Feb 05 '23 15:02 brent-schmidtbauer