-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support trustmode appcontainer in FilePickers #18321
Comments
just as a note - as I think this is related: The following code works on windows until calling RequestAccessAsync() which throws a COM Exception var capability = AppCapability.Create("location");
var stat = capability.CheckAccess();
if (stat == AppCapabilityAccessStatus.Allowed)
{
return true;
}
var rar = await capability.RequestAccessAsync(); |
I don't think we can switch to WinUI FileOpenPicker APIs.
Pretty sure it's still the solution for Windows apps :) |
At least in old UWP sandboxing, you didn't have to enable these capabilities for file pickers.
Just in case, do you need to pick files in system32? It might not be possible even with capabilities. |
No. And no matter which folder I try to open (literally), I get the "Access denied" messagebox.
So you suggest this is a bug, then? Shall I file one? |
@gentledepp I don't know if it's really a bug, and is it on our side. |
Is your feature request related to a problem? Please describe.
We are trying to develop a windows application that runs in trustmode appcontainer.
Until now, we were able to overcome any obstacles.
But implementing a file picker seems not doable.
Approach 1: Using StorageProvider
Either we use the provided
StorageProvider.GetOpenFilePickerAsync
method.then this results in a window being shown that only opens message boxes saying "Access denied"
Approach 2: Trying to use Windows native APIs
So as approach 1 failed, we tried to use
this throws a
System.UnauthorizedAccessException
stacktrace:
Note: We added all necessary capabilities to our appxmanifest:
We also enabled the "broadFileSystemAccess" in the windows settings
Describe the solution you'd like
Easiest option for users:
Make the StorageProvider realize if it is running in an appcontainer.
If so, use a specialized storageprovider for this...
... so that the
StorageProvider.OpenFilePickerAsync
also works for apps running in an appcontainer.Alternative approach:
Provide a valid handle (intpr) that can be used to use windows native features.
Please let me know if you need a repro.
Describe alternatives you've considered
Running our app in fullTrust - but come on. It is 2025 - this cannot be the solution :-(
Additional context
We are happy to help move this forward and contribute. But have no idea where to start.
Please let us know!
The text was updated successfully, but these errors were encountered: