Wasm: FileOpenPicker's StorageFile throws exception when calling Flush on the read stream #5751
Closed
2 of 24 tasks
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
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:
Nuget Package Version(s):
Affected platform(s):
IDE:
Relevant plugins:
Anything else we need to know?
The text was updated successfully, but these errors were encountered: