xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.53k stars 506 forks source link

Xamarin.Essentials 1.8.0 FilePicker gives NotImplementedInReferenceAssemblyException #2101

Closed Doug910 closed 8 months ago

Doug910 commented 9 months ago

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

  1. Create a FilePicker test program using Xamarin.Essentials version 1.6.0.
  2. Test the Android implementation and check that it works as expected.
  3. Update Essentials to 1.8.0.
  4. Test again on Android.

Expected Behavior

Get FilePicker displayed and working on device

Actual Behavior

Get NotImplementedInReferenceAssemblyException when the PickOptions are created.

Basic Information

Doug910 commented 9 months ago

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.

MitchBomcanhao commented 9 months ago

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.

Doug910 commented 9 months ago

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.

jfversluis commented 8 months ago

Looks like this has been resolved, thanks!