0

I am using the Xam.Plugin.FilePicker on xamarin android from https://github.com/Studyxnet/FilePicker-Plugin-for-Xamarin-and-Windows

If user selected an image from the picker, everything is fine. When user cancel or didn't select any of the file, then open the picker again the exception occur.

enter image description here

The package somehow work inside my newly creation project which only have a button and the code for opening up the picker.

LittleFunny
  • 8,155
  • 15
  • 87
  • 198

2 Answers2

1

The nuget version may have outdated. Used the github version work at the moment.

LittleFunny
  • 8,155
  • 15
  • 87
  • 198
0

The error comes from not handling exceptions from PickFile() that is await'ed. The exception that was (maybe) thrown just disappears in the finished Task. Most probable cause is that you're on Android 6.0 or higher and you didn't request permission to access files from the user.

btw, there are several forks of the FilePicker Xamarin plugin. I recommend the following project, since it's the most actively maintained one: https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows (note: I'm one of the contributors to the project). When using this project, you should get the correct exception text that explains what went wrong.

vividos
  • 6,468
  • 9
  • 43
  • 53