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

FileOpenPicker, FolderPicker and FolderPicker not available in partial trust/AppContainer #9557

Open
sungaila opened this issue Apr 18, 2024 · 4 comments
Labels
bug Something isn't working team-Reach Issue for the Reach team

Comments

@sungaila
Copy link

Describe the bug

In WinUI 3 it is needed to do the following call to initialize a picker dialog:

WinRT.Interop.InitializeWithWindow.Initialize(openPicker, hWnd);

It works just fine in full trust mode but fails when it is called in partial trust/inside an AppContainer (access denied exception).

This is terrible news because it means that WinUI 3 can either use the WinRT file dialogs OR run in partial trust. But NOT both at the same time.

Steps to reproduce the bug

  1. Create a packaged WinUI 3 app with the default template
  2. Change Package.appxmanifest such that the app runs in partial mode
  3. Optional: add the broadFileSystemAccess capability
  4. Test the FilePicker code snippet from the WinUI 3 Gallery: winui3gallery://item/FilePicker

Expected behavior

The file dialogs should open just as expected.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.2: 1.5.240404000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@sungaila sungaila added the bug Something isn't working label Apr 18, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Apr 18, 2024
Copy link

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!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@bpulliam bpulliam added team-Reach Issue for the Reach team and removed needs-triage Issue needs to be triaged by the area owners labels Apr 18, 2024
@Rybasum
Copy link

Rybasum commented May 1, 2024

This issue is several years old and it looks like Microsoft simply does not want us to put non-UWP apps in AppContainer. Otherwise they would realize that most UI apps use file open/save pickers. AppContainer? yes, sure, but no file open/save. Very strange. Honestly, they should simply document this and not make developers waste their time.

@sungaila
Copy link
Author

sungaila commented May 2, 2024

@Rybasum The documentation part is kinda confusing. There is in-depth documentation on how to put your WPF, WinForms or WinUI 3 app into an AppContainer using MSIX. Yet something fundamental like selecting files isn't possible with Win32 or WinRT APIs.

I have a simple WinUI 3 app here where the user selects a file and more information is put into a DataGrid. You'd think that it would be a perfect candidate for partial trust/AppContainer and just the filesystem capability.

@mominshaikhdevs
Copy link

mominshaikhdevs commented Aug 8, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Reach Issue for the Reach team
Projects
None yet
Development

No branches or pull requests

4 participants