Xamarin.Essentials 1.8.0 FilePicker gives NotImplementedInReferenceAssemblyException
Doug910 opened this issue · 4 comments
Description
FilePicker worked when using Essentials 1.6.0, when I upgraded to 1.8.0 I get this exception in Android every time.
Steps to Reproduce
- Create a FilePicker test program using Xamarin.Essentials version 1.6.0.
- Test the Android implementation and check that it works as expected.
- Update Essentials to 1.8.0.
- Test again on Android.
Expected Behavior
Get FilePicker displayed and working on device
Actual Behavior
Get NotImplementedInReferenceAssemblyException when the PickOptions are created.
Basic Information
- Version with issue: 1.8.0
- Last known good version: 1.6.0
- IDE: Visual Studio 2022
- Platform Target Frameworks: Android API 28
- Android: 9.0
- Nuget Packages: Xamarin.Forms 4.3.0.908675 (same error with later versions), Xamarin.Essentials 1.8.0
- Affected Devices: Android Emulator Pixel 5 Android 9
This exception was caused by Essentials not being initialised, because the Platform.Init line would not compile with a target of API 28, so it was commented out.
It would be a lot more informative to have an "essentials not initialised exception", this would have saved me a lot of time trying to figure out what was wrong.
target api 28 has been obsolete for several years now, you wouldn't even be allowed to publish such an app to the store, so your starting position was something that wouldn't be workable on a production environment anyway. and if you commented out the init line that the documentation clearly states you need, then it is sort of an own goal. you are not following the documentation and you're targeting a version of android which hasn't been acceptable in production for several years now.
The app is for a particular set of work devices running api 28, I have no plans to publish it. It is a bit annoying being forced to target api 33, just to get the compiler to recognise that Essentials.Platform exists.
Looks like this has been resolved, thanks!