Handle cancellation of TextReader
/TextWriter
access resiliently
#111
Labels
area: io
Issues related to core terminal I/O.
state: approved
Enhancements and tasks that have been approved.
Milestone
The
TextReader
/TextWriter
andStream
properties exposed on theTerminalReader
/TerminalWriter
andTerminalHandle
classes, respectively, are meant to be long-lived and resilient. For theStream
property, this works as expected; disposal does nothing and cancellation has no lasting effect (other than potentially losing some input/output that was scheduled).Unfortunately,
System.IO.StreamReader
/System.IO.StreamWriter
are not guaranteed to be in a valid state after a cancellation has occurred. This means that our properties can be rendered unusable if the user ever performs cancellation.The main reason we have these properties is line-based input:
cathode/src/core/IO/TerminalReader.cs
Lines 69 to 77 in 695b297
(Other than the above, these properties are not used in Cathode itself.)
The only solution I see here is to implement our own derived
System.IO.TextReader
/System.IO.TextWriter
classes specialized for our needs. We can then do whatever we need to do to keep the state valid across cancellations.The text was updated successfully, but these errors were encountered: