Skip to content

[BUG] Unable to Save Multi GB Files using FileSaver on Android #1605

@DavidJSnyder

Description

@DavidJSnyder

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

I am unable to save 2GB+ files/streams using FileSaver on Android. The attempt returns an error message of "Stream too long" even when there is enough space to write the file. It also leaves behind a 0 byte file in the target directory. I think this would be possible if the Android implementation wrote the contents of the stream in chunks rather than attempting to load it into an array in memory as it currently does.

Expected Behavior

I would expect FileSaver to be able to handle a file that large when there is sufficient space on the Android instance (such as in the Windows Subsystem for Android.) This would also eliminate the 0 byte file.

Steps To Reproduce

  1. Open the solution from the reproduction directory. Make sure is target an Android instance that has space to write 4 GB+ such as the Windows Subsystem for Android and run the project.
  2. Click the Button and select a target directory such as Download.
  3. Note that the call to FileSaver fails with the message "Stream too long." Check the contents of the directory you selected and notice the 0 byte file left behind.

Link to public reproduction project repository

https://github.com/DavidJSnyder/NETMAUIBigFileSaveExample

Environment

- .NET MAUI CommunityToolkit: 7.0.1
- OS: Windows 11 22H2 Build 22621.2861
- .NET MAUI: 8.0.3/8.0.100
- Windows Subsystem for Android: 2310.4000.2.0

Anything else?

I previously opened a discussion for this issue at #1554 and was asked to open a bug report.

Metadata

Metadata

Labels

area/essentialsIssue/Discussion/PR that has to do with EssentialsbugSomething isn't workingunverified

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions