Open
Description
A number of improvements were made to FileStream
in .NET 6: https://devblogs.microsoft.com/dotnet/file-io-improvements-in-dotnet-6
FileStream
is now looking like a more attractive option for I/O compared to the hand-rolled interop we do right now.
That said, there are three major issues:
Windows: For as long as we need the UTF-8 input workaround (see Switch to UTF-8 input on Windows #68), we will need to keep a code path that doesn't useNo longer an issue as this workaround was removed.FileStream
since we need to useReadConsole
as opposed toReadFile
in that case.- Unix: There is no first-class support for asynchronous operations and cancellation in
FileStream
yet. This would make it a functional downgrade over what we have now withUnixCancellationPipe
. RandomAccess
: It would be ideal to useRandomAccess
directly, but this is not currently possible due to arbitrary type requirements.
The (eventual) benefits of the switch would be improved performance, 'free' support for OS-native asynchronous operations, cancellation support, and more maintainable terminal driver code.