unify error handling for FileStream and Pipe Streams#77543
unify error handling for FileStream and Pipe Streams#77543adamsitnik merged 7 commits intodotnet:mainfrom
Conversation
…ientStream.Read* methods
|
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsTODO:
|
| public static class UnifiedErrorHandlingTests | ||
| { | ||
| [Fact] | ||
| public static void WhenAnonymousPipeServerIsClosedAnonymousPipeClientReadReturnsZero() |
There was a problem hiding this comment.
Nit:
I'm finding it very difficult to read and tell apart all of these different test names, including pulling out the salient details. Can you restructure them to a form something along the lines of:
AnonymousPipeServer_AnonymousPipeClient_ServerClosed_ReadReturnsZero
AnonymousPipeServer_FileStreamClient_ServerClosed_ReadReturnsZero
NamedPipeServer_FileStreamClient_ServerDisconnects_ReadReturnsZero
...
etc.?
There was a problem hiding this comment.
@stephentoub can we meet somewhere in the middle?
- WhenAnonymousPipeServerIsClosedAnonymousPipeClientReadReturnsZero
+ When_AnonymousPipeServer_IsClosed_AnonymousPipeClient_ReadReturnsZeroSince we are using the [Fact] to annotate the tests I am trying to name in the way that they describe the fact they are testing.
src/libraries/System.IO.Pipes/tests/UnifiedErrorHandlingTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs
Show resolved
Hide resolved
|
The test failures are unrelated (#78017), merging. |
|
@stephentoub thank you for the review! We are one step closer to PipeStream and File Stream code unification (preferably reuse) |
This PR changes
FileStreamto matchAnonymousPipe*Stream,NamedPipe*Streamedge case error handling. Namely:FileStreamfails with an exception rather than reporting success and writing nothing (what we had so far).FileStreamreturns zero rather than throwing an exception (what we had so far).