-
Notifications
You must be signed in to change notification settings - Fork 705
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
Packaged WinUI 3 app can only p/invoke local DLLs on ARM when run as Admin #9335
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you! Closed similar issues:
|
I have more information. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) But as soon as the app runs as Admin, the DLL loads without any issue. |
Have you tried doing the same thing with an application compiled for ARM64? I appreciate that the library you are trying to load may not have an ARM64 equivalent, so having a smaller test would be useful. Also, have you checked the ACL on the DLL that you are trying to load? Just to be sure that Windows didn't somehow mangle the DACL when the package was installed. |
@DarranRowe Yes, I did try to build for ARM64, but the DLLs remain x64, so this does not work either. I looked into the access permissions. For that I had to take ownership of the WindowsApps folder. Now I have full control to all the files. But unfortunately this does not solve this issue. Tl;dr: even with full access rights to all installation files, I get the same behavior: I need to run the app as Admin before it can P/invoke into DLLs. |
I have been testing things related to this, and I have not been getting any kind of reproduction. |
Hi @DarranRowe, thank you for taking the time looking into this. I tried the same with another DLL and this works without any issues on arm64. I got the System.BadImageFormatException when using .NET for arm64 combined with a x64 DLL. I turns out the issue has to do with the windows.toastNotificationActivation extension. This does crash on arm64 when not running as administrator. Sorry for the misleading information. I will close this issue and will open another one. |
Describe the bug
We have issues with our packaged x64 WinUI3 app when running on ARM64. This app runs without any issues on x64.
P/Invoke to DLLs in the application folder does not work, unless the app is started as Administrator.
The app runs with full trust (as it is a WinUI 3 packaged app).
I tried to target as arm64 as well, but this gave me even more issues. Running as administrator did not help solve the issue in this case.
Steps to reproduce the bug
To successfully run the app, run Xelion as Administrator.
Expected behavior
The app should be able to p/invoke DLLs from the installation folder without the need for Admin privileges.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.4.5: 1.4.240411001
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
The text was updated successfully, but these errors were encountered: