Essentials
Essentials copied to clipboard
[Bug] Launcher Feature does not open file correctly on IOS.
Description
Launcher Feature does not open file correctly on IOS.
Scenario 1:
I can reproduce this error in your sample application.
await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(file), PresentationSourceBounds = rect });
Scenario 2:
await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(FullPath, System.Net.Mime.MediaTypeNames.Application.Pdf) });
Steps to Reproduce
Scenario 1:
- Open Xamarin.Essentials sample application.
- Go to Launcher sample
- Type some text on File Contents
- Click on Open File button.
Scenario 2:
- Get a pdf path.
- Execute Scenario 2 code: Launcher.OpenAsync with ReadOnlyFile(FullPath, System.Net.Mime.MediaTypeNames.Application.Pdf) overload.
Expected Behavior
Scenario 2:

Actual Behavior
Scenario 1:
Application throws an unhandled exception as follows: System.ArgumentNullException has been thrown Value cannot be null. Parameter name:uti
Scenario 2:

Basic Information
- Version with issue:
- Last known good version:
- IDE: Visual Studio 2022 Mac
- Platform Target Frameworks:
- iOS: 15.5
- Android: Android 12.0 - S API Level 31
- UWP: N/A
- Android Support Library Version:
- Nuget Packages:
- Affected Devices:
This seems related to https://github.com/xamarin/Essentials/issues/1877. Please check if the workaround I found https://github.com/xamarin/Essentials/issues/1877#issuecomment-1206154979 works for you.
This seems related to #1877. Please check if the workaround I found #1877 (comment) works for you.
That was the 2 Scenario, even when using second parameter, the behaviour should be open the document, not the edit actions middle screen .
Indeed I understand. Xamarin is in security support since MAUI is out now so I assume these bugs will not be addressed anymore. I would suggest to either move to MAUI or if not possible use a workaround (for example I open PDFs in iOS via the browser).