-
Notifications
You must be signed in to change notification settings - Fork 322
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
FolderPicker works fine on most user systems but on some systems it gives exception 0x80004005 #4625
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:
|
The window handle, aka the HWND, is the identity of the window. While the window that is created by Microsoft.UI.Xaml.Window stays alive, the HWND will never change. While this is wrapped up to look like the UWP model, this is still the desktop environment.
Assuming the "runFullTrust" capability is there due to the package being full trust, either by setting the entry point to windows.fullTrustApplication or by setting uap10:TrustLevel to mediumIL, then capabilities don't really affect the application. The capabilities are there to tell the appcontainer what it is allowed to access, not the package. So when the application is running outside of an appcontainer, which is the case when you set the package to windows.fullTrustApplication/mediumIL, then you have almost the same environment as if the application is running unpackaged. The only difference shouldn't have an effect on the pickers, since registry writes to HKCU and filesystem writes to AppData should be redirected to the package profile directory. I assume the above because of how infrequently you stated the problem occurs. But just to mention it. If your application is running as partial trust, either by setting the entry point to windows.partialTrustApplication or by setting uap10:TrustLevel to appContainer, then it will be running into the long running problem of pickers not being allowed to set a HWND as the parent. The only thing I can think of is when the Documents library has been redirected. While the Documents library is at %USERPROFILE%\Documents by default, it is possible to change where it is stored. It is also possible to add directories to the library too. So I'm wondering if it has been redirected by OneDrive or something else on the systems which have failed. |
@DarranRowe In the mean time I got additional feedback from a user stating that the issue occurs when the app is opened "as admin". I then tested this also and indeed also get the exception when running as admin. BTW: The reason the user opens the app "as admin" is because the app when opened in the normal user context failed to respond on any click command and crashes. Windows Event Viewer lists an error indicating that the Microsoft.UI.Input.dll can't be accessed (with exception 0xC0000602). It turns out that the user's 3D Connection mouse driver is causing this. With the mouse driver disabled the app runs without problems. |
It's a known issue that the File/FolderPickers don't work as admin... #2504 Workaround is to revert to the good old Win32/COM API: https://learn.microsoft.com/en-us/uwp/api/windows.storage.pickers.filesavepicker?view=winrt-22621#in-a-desktop-app-that-requires-elevation |
@JosHuybrighs But I also believe that more of a focus should be placed on the underlying issue here. 0xC0000602 is the NTSTATUS STATUS_FAIL_FAST_EXCEPTION. Fail fasts are used in places where it would indicate that things are so broken that it is just better to kill the application. Knowing what causes this allows for proper investigation of the issue. In the end, getting the driver fixed is the best option all around. |
@DarranRowe
and the following in NativeMethods.txt
|
Describe the bug
I have a strange exception that some users have reported to occur when using FolderPicker as follows:
The picker popup isn't displayed and using a try/catch block and some logging in the app I can see that exception 0x80004005 is raised with an empty Exception.Message.
The window handle which is required in WinUI3/WinAppSDK is assigned by getting it from a static property in MainWindow.
Assignment of the static is done in the constructor of MainWindow, like so:
The app is available on the Store and most users don't seem to have a problem.
Some thoughts:
Steps to reproduce the bug
Can't reproduce this.
The error only occurs on some systems.
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.5.5: 1.5.240607001
Windows version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: