Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[Bug] [FilePicker] [Android] Exception is thrown when picking some files #1483

Closed
IngweLand opened this issue Oct 28, 2020 · 7 comments · Fixed by #1555
Closed

[Bug] [FilePicker] [Android] Exception is thrown when picking some files #1483

IngweLand opened this issue Oct 28, 2020 · 7 comments · Fixed by #1555
Labels
bug Something isn't working
Milestone

Comments

@IngweLand
Copy link

IngweLand commented Oct 28, 2020

Description

Java.IO.FileNotFoundException: File is virtual is thrown when pciking some files from Google drive. Not sure what are those virtual files exactly, but probably some file entities on Google Drive which have some dynamic content (just a pure guess).

Steps to Reproduce

  1. Have such "virtual file" on your google drive
  2. Try to pick it
  3. Call OpenReadAsync on FileResult

Expected Behavior

Either throw Net exception (and not a Java one) or pick the file (if it's possible to pick those virtual files at all).

Actual Behavior

Throws Java exception

Basic Information

  • Version with issue: 1.6.0-pre2
  • Last known good version:
  • IDE: VS 2019
  • Platform Target Frameworks:
    • Android: 11.0
  • Affected Devices: Tested on Google Pixel 3a
@IngweLand IngweLand added the bug Something isn't working label Oct 28, 2020
@IngweLand IngweLand changed the title [Bug] [Android] Exception is thrown when picking some files [Bug] [FilePicker] [Android] Exception is thrown when picking some files Oct 28, 2020
@vividos
Copy link
Contributor

vividos commented Oct 29, 2020

How do you create a "virtual file"? And do you have a stack trace for us?

@IngweLand
Copy link
Author

It feels like any document created on google drive and shared with you might be a virtual file

  1. Have 2 Google accounts, one of which is used on the testing device.
  2. Sign in into Google Drive with the second account, create Google document, and share it with viewer permission with your main account
  3. Pick that file on the device

@IngweLand
Copy link
Author

Java.IO.FileNotFoundException: File is virtual: acc=3;doc=encoded=oX0eiSgeztRLkXJOtaCmP93xC/+3eZbLp1WycFZK1PDDSRi/98GX2Gj/ at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008e] in <42748fcc36b74733af2d9940a8f3cc8e>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in <42748fcc36b74733af2d9940a8f3cc8e>:0 at Android.Content.ContentResolver.OpenInputStream (Android.Net.Uri uri) [0x00031] in <227a96d68a0440cea172be41b1306654>:0 at Xamarin.Essentials.FileBase.PlatformOpenReadAsync () [0x0001e] in D:\a\1\s\Xamarin.Essentials\FileSystem\FileSystem.android.cs:119 at Xamarin.Essentials.FileBase.OpenReadAsync () [0x00000] in D:\a\1\s\Xamarin.Essentials\FileSystem\FileSystem.shared.cs:105 at QQQ.uploadFile (Xamarin.Essentials.FileResult fileData) [0x001ee] in qqqqq.cs:554 --- End of managed Java.IO.FileNotFoundException stack trace --- java.io.FileNotFoundException: File is virtual: acc=3;doc=encoded=oX0eiSgeztRLkXJOtaCmP93xC/+3eZbLp1WycFZK1PDDSRi/98GX2Gj/ at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:151) at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:781) at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1983) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1798) at android.content.ContentResolver.openInputStream(ContentResolver.java:1475) at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@IngweLand
Copy link
Author

https://stackoverflow.com/questions/46422736/how-to-open-inputstream-for-a-virtual-file-on-the-cloud

@Stecpoint
Copy link

We have the same problem. Is there a WA?

@Stecpoint
Copy link

https://stackoverflow.com/questions/46422736/how-to-open-inputstream-for-a-virtual-file-on-the-cloud

this methods can detect that file is virtual, but cant open stream for file..
Method for get virtual file return exception: Java.IO.FileNotFoundException: File is virtual.
@IngweLand, how did you solve the problem? Did you manage to open the virtual file?

@Stecpoint
Copy link

for filter virtual files when create intent need add string:
intent.AddCategory(Intent.CategoryOpenable);

this string disabled files, which can't loaded from other apps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants