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

Wasm: FileOpenPicker's StorageFile throws exception when calling Flush on the read stream #5751

Closed
2 of 24 tasks
alove-kahua opened this issue Apr 14, 2021 · 0 comments · Fixed by #5768
Closed
2 of 24 tasks
Assignees
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui)
Milestone

Comments

@alove-kahua
Copy link
Contributor

Current behavior

Calling Flush after opening a read stream from a StorageFile throws exception. This is different than UWP and the documentation states it should be acceptable.

Documentation:
Because a buffer can be used for either reading or writing, Flush() performs the following two functions:

Any data previously written to the buffer is copied to the file and the buffer is cleared except for its encoder state.

If BufferedStream.CanSeek is true and data was previously copied from the file to the buffer for reading, the current position within the file is decremented by the number of unread bytes in the buffer. The buffer is then cleared.

Expected behavior

No exception is thrown.

How to reproduce it (as minimally and precisely as possible)

StreamReadAsyncException.zip

Workaround

Either don't call Flush, or temporarily catch the exception and swallow it.

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: )
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@alove-kahua alove-kahua added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Apr 14, 2021
@jeromelaban jeromelaban added project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui) difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. triage/untriaged Indicates an issue requires triaging or verification project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools labels Apr 14, 2021
@MartinZikmund MartinZikmund self-assigned this Apr 15, 2021
@MartinZikmund MartinZikmund added this to the 3.7 milestone Apr 15, 2021
@MartinZikmund MartinZikmund added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Apr 15, 2021
MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Apr 16, 2021
- Fixes unoplatform#5751 by making Flush a no-op for some of the Storage read-only streams
@mergify mergify bot closed this as completed in #5768 Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants