Maui FilePicker results in This platform does not support this file type.
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
I am building a desktop app in .NET Maui which targets Windows and MacOS. When using the built-in FilePicker on Mac (Catalyst) I get the following error:
{System.PlatformNotSupportedException: This platform does not support this file type. at Microsoft.Maui.Storage.FilePickerFileType.GetPlatformFileType(DevicePlatform platform) at Microsoft.Maui.Storage.FilePickerFileType.get_Value() at Microsoft.Maui.S…}
I have tried multiple file types, including csv, jpg, text/csv but nothing works.
`public async Task ImportCSV()
{
try
{
var customFileType = new FilePickerFileType(
new Dictionary>
{
{ DevicePlatform.WinUI, new[] { ".csv" } },
{ DevicePlatform.macOS, new[] {"csv"} }
});
PickOptions options = new()
{
PickerTitle = "Please select a csv file",
FileTypes = customFileType
};
var file = await FilePicker.Default.PickAsync(options);
if (file != null)
{
string filePath = AppStateService.fixMacFilePath(file.FullPath);
AppStateService.AppState.csvFilePath = filePath;
await InitiateCsvMapping();
}
}
catch (Exception ex)
{
}
}`
### Steps to Reproduce
1. Create a new Maui app.
2. Remove iOS and Android targets from project file.
3. Execute the shared code
### Version with bug
6.0.400
### Last version that worked well
Unknown/Other
### Affected platforms
macOS
### Affected platform versions
MacCatalyst 14.0
### Did you find any workaround?
The documentation does say that I should "Enable iCloud capabilities" but does not provide any links or other information regarding this. I did some digging, and found some documentation that says that it necessary to do this via the Entitlements.plist file which I did but it seems to only be relevant when publishing your app to the App store which I am not during development. I don't even care about iCloud right now. I just want to select a CSV file from my own desktop.
### Relevant log output
```shell
{System.PlatformNotSupportedException: This platform does not support this file type.
at Microsoft.Maui.Storage.FilePickerFileType.GetPlatformFileType(DevicePlatform platform)
at Microsoft.Maui.Storage.FilePickerFileType.get_Value()
at Microsoft.Maui.S…}
```
Contributor guide
Research direction
Reproduce the shared FilePicker code from the issue in a .NET MAUI app targeting MacCatalyst 14.0, then trace Microsoft.Maui.Storage.FilePickerFileType.GetPlatformFileType and its platform-specific handling. Check the referenced Entitlements.plist guidance and existing FilePicker tests or implementation paths. Done means selecting a CSV or other listed file type on macOS no longer raises PlatformNotSupportedException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100