I am trying to pick a file using the following code
FileData fileData = new FileData();
fileData = await CrossFilePicker.Current.PickFile();
if (fileData != null)
and getting the following exception
at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overfl
owResourceKey) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/shared/System/Number.Parsing.cs:1781
at System.Number.ParseInt64 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x00016] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/shared/System/Number.Parsing.cs:246
at System.Int64.Parse (System.String s) [0x0000a] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Int64.cs:106
at Plugin.FilePicker.IOUtil.GetPath (Android.Content.Context context, Android.Net.Uri uri) [0x000ab] in D:\a\1\s\src\Plugin.FilePicker\Android\IOUtil.android.cs:64
at Plugin.FilePicker.FilePickerActivity.OnActivityResult (System.Int32 requestCode, Android.App.Result resultCode, Android.Content.Intent data) [0x00039] in D:\a\1\s\src\Plugin.FilePicker\Android\FilePickerActivity.android.cs:151
--- End of stack trace from previous location where exception was thrown ---
and the exception message saying "Input string was not in a correct format".
I am trying it for so long, but unable to find the solution.
Android version - 10
I am using the latest stable version for Xamarin.Essentials but FilePickerAsync() is not accessible.
In the latest version for Xamarin.Essentials, to get :
using Xamarin.Essentials;
public async void getFile()
{
var result = await FilePicker.PickAsync();
//...
}
The ReadExternalStorage
permission is required:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />