Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FolderPicker does not work in UWP Windows 10 app (mobile)

I am developing an UWP Windows 10 app. Given following code sample....

using Windows.Storage;
using Windows.Storage.Pickers;

FolderPicker picker = new FolderPicker() { SuggestedStartLocation = PickerLocationId.PicturesLibrary };

picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".jpeg");
StorageFolder folder = await picker.PickSingleFolderAsync();

if (folder != null) { ... work ... }

...everything works fine on Desktop.

On Mobile, unfortunately (build 10.0.10549), the first time I invoke the method, a system-dialog appears where I can choose "My device" as a single option. Clicking this option results in a start of the system-file-explorer-app followed by an immediate close/crash/whatever of that app. So I find myself back in my own app with folder == null. When I now try to run the given snippet again, PickSingleFolderAsync() throws an UnauthorizedAccessException ("Access is denied"). However, if I place a breakpoint on the line with PickSingleFolderAsync(), the app does not crash but like in the first try, the file-explorer app returns immediately again, without any folder.

Reference zu method: https://msdn.microsoft.com/de-de/library/windows/apps/windows.storage.pickers.folderpicker.picksinglefolderasync

like image 434
tipa Avatar asked Oct 30 '22 16:10

tipa


1 Answers

It seems that the Win10 mobile build 10572 fix the error. I have experienced the same folderpicker issue with build 10549, but after updating to 10572, it works.

Added 05/Nov/2015 - App deployment from VS to Win10M devices works well with VS2015 Update1 RC + Win10M 10581. You may see the error messagebox when you tried to 'Run without debug', but deploy itself works.

like image 52
Mamoru Satoh Avatar answered Nov 15 '22 06:11

Mamoru Satoh