Skip to content

Picking a lot of files with FilePicker is extremely slow on Windows, and can raise access exceptions on iOS #19868

@whodges

Description

@whodges

Description

Ok, first off: I understand this isn't a common use case, but, in my opinion, it should still work. That said, if I use FilePicker.PickMultipleAsync to select a plethora of files in a folder (say, 200 - and they can be super tiny text files), I experience the following behavior:

Windows: after you click OK, you'll be waiting a very long time for the file results to get returned. Like, close to a minute (even in Release).

iOS: if you try and open one of the returned files, you can get an UnauthorizedAccessException. I typically find this happens with about 200 files, though sometimes it's more. In my testing it can be as low as 180. Sometimes 250+. But it will happen if you select enough. If you only select a few, then it works fine. And sidebar: sometimes I swear I tap 'Open' on iOS with files selected, but then it says no files were picked. If I try again it works.

I made a repo here that can be used to reproduce the problem: https://github.com/whodges/mauifilepicker.git. I also included a CreateTestTextFiles utility method that will make 1000 tiny text files in a specified folder that you can subsequently select via the FilePicker when the app is run. I created them on Windows, then moved them to my MacBook and subsequently to my iPhone (which is an iPhone 14 Pro, btw).

Steps to Reproduce

  1. Get and run the MauiFilePicker app from my repo. Notice in MainPage.OnOpenClickedAsync I have call to CreateTestTextFiles that's commented out; uncomment it for your first run (updating TestTextFileFolder to whatever you want it to be) to make a bunch of tiny files to select via FilePicker.
  2. When the app's run, clicked its 'Open Files...' button, and select all or a subset of said text files (pick at least 250).
  3. At this point, the app will get the results and then try and open and close each file. If you only picked a few files, everything is fine. If you pick a lot, Windows will take a very long time to return the selection results (this is prior to opening and closing each file), while iOS will likely choke with an UnauthorizedAccessException.

Link to public reproduction project repository

https://github.com/whodges/mauifilepicker.git

Version with bug

8.0.5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Windows

Affected platform versions

iOS 17.1.2, Windows 10.0.1.19045

Did you find any workaround?

Nope.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions