question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FilePicker on MacOS does not always return the file picked

See original GitHub issue

Description

While using FilePicker on MacOS it will regularly return null for the FileResult when a file is chosen. Code below. After a few selects it works. No exceptions or crashes. Any ideas?

Version 17.4 Preview (17.4 build 2366) Runtime .NET 6.0.9 (64-bit) Architecture: X64

        [RelayCommand]
	private async void SelectFile()
	{
		FileResult result = null;
            try
            {
                FilePickerFileType filePickerFileType = new FilePickerFileType(
                    new Dictionary<DevicePlatform, IEnumerable<string>>{
                    { DevicePlatform.MacCatalyst, new [] { "json" } },
                    { DevicePlatform.macOS, new [] { "json"} },
                    { DevicePlatform.WinUI, new [] { ".json" } }
                    });
                PickOptions pickOptions = new PickOptions
                {
                    PickerTitle = "Choose an engine file.",
                    FileTypes = filePickerFileType
                };

                result = await FilePicker.Default.PickAsync(pickOptions);
            }
            catch (Exception e)
            {
                Console.WriteLine(String.Format("Exception {0}", e.Message));
            }
            if (null != result)
		{

<Button Text="Select..." Command="{Binding SelectFileCommand}"/>

Steps to Reproduce

Create a new .net Maui App Add a button. Add a relay command for the button. Use code above to select a file.

Link to public reproduction project repository

n/a

Version with bug

7.0 Release Candidate 2

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS 12, 13

Did you find any workaround?

No

Relevant log output

+[CATransaction synchronize] called within transaction

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:35 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
cdavidyoungcommented, Mar 17, 2023

Hang means in my app it does not return from the call to FilePicker.

I can’t provide a sample of this happening because it works fine in the standard Maui app. I wish I could. It only happens in my app.

1reaction
cdavidyoungcommented, Mar 17, 2023

I have tried my app on both Ventura and Monterey. The FilePicker hangs in both cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File picker does not show all files in th…
File picker does not show all files in the folder until I navigate to another folder and then back. I've been encountering this...
Read more >
FilePicker throwing an exception on mac OS with .net MAUI
PickAsync it seems to throw an PlatformNotSupportedException with this message: This platform does not support this file type.
Read more >
File Picker doesn't work - Claris Community
Im using El Capitan 10.11 Beta. The field picker doesn't work properly. If i scroll down through the list of fields quickly Filemaker...
Read more >
Can't select files or folders in dialog box - Ask Different
I can only press Tab, the arrow keys and Enter on my keyboard to move around, although this doesn't work correctly.
Read more >
File picker sometimes doesn't work in 2.7.9
The problem is that once I have loaded a video to process, any operation involving the file picker doesn't work. So for example,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found