CommunityToolkit / CommunityToolkit/Maui

[BUG] Enable to use FolderPicker on windows without Capability runFullTrust

Open
#2,686 2 comments 2 reactions 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

I build a basic MAUI App and try to use FolderPicker for the users to pick a folder where they will save their data files.
It works well with capability runFullTrust like show 99% of the web tutorial.
But windows store doesn't allow it.

### Expected Behavior

The Folder picker should open and allows user to select a folder.

### Steps To Reproduce

I set the Package.appxmanifest file with Capabilities without runFullTrust.
```








```

I run the following code:
`var result = await FolderPicker.Default.PickAsync();`

I get the error: Attempted to perform an unauthorized operation.
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at WinRT.Interop.IInitializeWithWindowMethods.Initialize(Object _obj, IntPtr window)
at WinRT.Interop.InitializeWithWindow.Initialize(Object target, IntPtr hwnd)
at CommunityToolkit.Maui.Storage.FolderPickerImplementation.d__2.MoveNext()
at CommunityToolkit.Maui.Storage.FolderPickerImplementation.d__0.MoveNext()

I try to be more specific be I get the same error :
`
await FolderPicker.Default.PickAsync(initialPath: Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
or
await FolderPicker.Default.PickAsync(Environment.CurrentDirectory);
`

### Link to public reproduction project repository

Needs reproduction

### Environment

```markdown
- .NET MAUI CommunityToolkit: 9.1.1
- OS: Windows 11
- .NET MAUI: 8.0.100
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.