-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
As of today, File.WriteAllBytes* APIs support non-seekable files, but File.ReadAllBytes* don't.
The following call to FileStream.Length is going to throw:
| long fileLength = fs.Length; |
The funny thing is that we already almost support it:
runtime/src/libraries/System.Private.CoreLib/src/System/IO/File.cs
Lines 341 to 348 in d033e1a
| else if (fileLength == 0) | |
| { | |
| #if !MS_IO_REDIST | |
| // Some file systems (e.g. procfs on Linux) return 0 for length even when there's content. | |
| // Thus we need to assume 0 doesn't mean empty. | |
| return ReadAllBytesUnknownLength(fs); | |
| #endif | |
| } |
We need:
- test that shows the broken scenario
- a fix
Metadata
Metadata
Assignees
Labels
area-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors