Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Andriod][FileSaver] Crash when removing USB drive #1588

Closed
2 tasks done
BaY1251 opened this issue Dec 4, 2023 · 17 comments · Fixed by #1751
Closed
2 tasks done

[BUG] [Andriod][FileSaver] Crash when removing USB drive #1588

BaY1251 opened this issue Dec 4, 2023 · 17 comments · Fixed by #1751
Assignees
Labels
area/essentials Issue/Discussion/PR that has to do with Essentials bug Something isn't working needs reproduction stale The author has not responded in over 30 days unverified

Comments

@BaY1251
Copy link

BaY1251 commented Dec 4, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Crash when removing USB drive in Android7.1 after save a file.
No Exception was throw.

Expected Behavior

File save Normally

Steps To Reproduce

  1. Open Toolkit\ Toolkit.sln
  2. Click 'FileSaver' to save a file to USB drive
  3. remove USB drive

Link to public reproduction project repository

https://github.com/BaY1251/MauiDebug.git

Environment

- .NET MAUI CommunityToolkit:7.0.0
- OS:Android7.1
- .NET MAUI:8.0

Anything else?

FileSaver

adb log here
"app died" in line 454
file.log

@BaY1251 BaY1251 added bug Something isn't working unverified labels Dec 4, 2023
@BaY1251
Copy link
Author

BaY1251 commented Dec 4, 2023

another Bug is report "Unable to resolve absolute path where the file was saved 'content://com.android.providers.downloads.documents/document/66'",
when save to the Internal storage.

@bijington
Copy link
Contributor

I'm struggling to follow when the error exactly occurs. Are you removing the USB stick during the save? Looking at your GIF the file only reaches 0KB when the dialog disappears but there should be some content.

@BaY1251
Copy link
Author

BaY1251 commented Dec 5, 2023

@bijington Not really! From Gif, it appears that the 'SaveAsync' method has returned and IsSuccessful==true!
Besides, I even tried to wait for ten minutes before unplugging the USB drive

@BaY1251
Copy link
Author

BaY1251 commented Dec 5, 2023

AND, The file is normal and can be viewed

file

@vhugogarcia vhugogarcia added the area/essentials Issue/Discussion/PR that has to do with Essentials label Dec 7, 2023
@bijington
Copy link
Contributor

@BaY1251 thanks for the clarification

@ghost
Copy link

ghost commented Mar 11, 2024

Hi @BaY1251. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@BaY1251
Copy link
Author

BaY1251 commented Mar 12, 2024

I wrote the wrong solution name,Sorry for the mistake.
it is Toolkit\ Toolkit.sln.

BaY1251 added a commit to BaY1251/CommunityToolkit.Maui that referenced this issue Mar 12, 2024
BaY1251 added a commit to BaY1251/CommunityToolkit.Maui that referenced this issue Mar 12, 2024
@BaY1251
Copy link
Author

BaY1251 commented Mar 12, 2024

I will create a PR #1746, for this issue

VladislavAntonyuk added a commit that referenced this issue Mar 13, 2024
brminnick pushed a commit that referenced this issue Mar 13, 2024
@BaY1251
Copy link
Author

BaY1251 commented Mar 14, 2024

This issue may need to be reopened, #1751 is invalid for #1588

@brminnick brminnick reopened this Mar 14, 2024
@VladislavAntonyuk
Copy link
Collaborator

I am not to reproduce the issue after the fix.

From docs:
An OutputStream you can create on a ParcelFileDescriptor, which will take care of calling ParcelFileDescriptor#close ParcelFileDescriptor.close() for you when the stream is closed.

Stream is closed on Dispose.

@BaY1251
Copy link
Author

BaY1251 commented Mar 14, 2024

Dispose() did not close the file.

Close
Dispose

@VladislavAntonyuk
Copy link
Collaborator

On screenshot you provide, Dispose is not called yet

@BaY1251
Copy link
Author

BaY1251 commented Mar 15, 2024

The first image shows FD closing after calling Close.
The second image shows that FD is still open after calling Dispose.

I am unable to view the source code of AutoCloseOutputStream. If you can see the source code, it would be best to confirm that

Stream is closed on Dispose

I confirm that AutoCloseOutputStream is invalid for all my existing devices.
You'd better test a few more Android devices and USB drives.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@dotnet-policy-service dotnet-policy-service bot added the stale The author has not responded in over 30 days label Apr 4, 2024
@BaY1251
Copy link
Author

BaY1251 commented Apr 6, 2024

复现问题的log和相关截屏我已经都提交了,#1751并没有解决问题,也没有改变log.
如果没有更多的人能复现这个问题,那这个问题应该就不是问题.可能大概只是我的问题吧.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

Copy link
Contributor

We haven't received a reproduction sample from you. The issue is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/essentials Issue/Discussion/PR that has to do with Essentials bug Something isn't working needs reproduction stale The author has not responded in over 30 days unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants