Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 69b9b44

Browse files
committed
Merge pull request #2863 from Maxwe11/cleanup-BeginRead-BeginWrite
Cleanup Begin/End usage for IO in PipeStream for Windows
2 parents 3439441 + fdc9d83 commit 69b9b44

File tree

12 files changed

+322
-930
lines changed

12 files changed

+322
-930
lines changed

src/Common/src/System/IO/StreamAsyncHelper.cs

Lines changed: 0 additions & 193 deletions
This file was deleted.

src/System.IO.Pipes/src/Resources/Strings.resx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
<data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
121121
<value>Non negative number is required.</value>
122122
</data>
123-
<data name="Argument_WrongAsyncResult" xml:space="preserve">
124-
<value>IAsyncResult object did not come from the corresponding async method on this type.</value>
125-
</data>
126123
<data name="Argument_InvalidOffLen" xml:space="preserve">
127124
<value>Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.</value>
128125
</data>
@@ -171,12 +168,6 @@
171168
<data name="ArgumentOutOfRange_MaxNumServerInstances" xml:space="preserve">
172169
<value>maxNumberOfServerInstances must either be a value between 1 and 254, or NamedPipeServerStream.MaxAllowedServerInstances (to obtain the maximum number allowed by system resources).</value>
173170
</data>
174-
<data name="InvalidOperation_EndReadCalledMultiple" xml:space="preserve">
175-
<value>EndRead can only be called once for each asynchronous operation.</value>
176-
</data>
177-
<data name="InvalidOperation_EndWriteCalledMultiple" xml:space="preserve">
178-
<value>EndWrite can only be called once for each asynchronous operation.</value>
179-
</data>
180171
<data name="InvalidOperation_PipeNotYetConnected" xml:space="preserve">
181172
<value>Pipe hasn't been connected yet.</value>
182173
</data>
@@ -258,9 +249,6 @@
258249
<data name="NotSupported_AnonymousPipeMessagesNotSupported" xml:space="preserve">
259250
<value>Anonymous pipes do not support PipeTransmissionMode.Message ReadMode.</value>
260251
</data>
261-
<data name="ObjectDisposed_FileClosed" xml:space="preserve">
262-
<value>Cannot access a closed file.</value>
263-
</data>
264252
<data name="ObjectDisposed_PipeClosed" xml:space="preserve">
265253
<value>Cannot access a closed pipe.</value>
266254
</data>
@@ -270,15 +258,6 @@
270258
<data name="UnauthorizedAccess_IODenied_NoPathName" xml:space="preserve">
271259
<value>Access to the path is denied.</value>
272260
</data>
273-
<data name="ObjectDisposed_StreamIsClosed" xml:space="preserve">
274-
<value>Cannot access a closed Stream.</value>
275-
</data>
276-
<data name="InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple" xml:space="preserve">
277-
<value>Either the IAsyncResult object did not come from the corresponding async method on this type, or EndRead was called multiple times with the same IAsyncResult.</value>
278-
</data>
279-
<data name="InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple" xml:space="preserve">
280-
<value>Either the IAsyncResult object did not come from the corresponding async method on this type, or EndWrite was called multiple times with the same IAsyncResult.</value>
281-
</data>
282261
<data name="UnknownError_Num" xml:space="preserve">
283262
<value>Unknown error '{0}'.</value>
284263
</data>

src/System.IO.Pipes/src/System.IO.Pipes.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU' " />
2121
<!-- Compiled Source Files -->
2222
<ItemGroup>
23-
<Compile Include="$(CommonPath)\System\IO\StreamAsyncHelper.cs">
24-
<Link>Common\System\IO\StreamAsyncHelper.cs</Link>
25-
</Compile>
2623
<Compile Include="Microsoft\Win32\SafeHandles\SafePipeHandle.cs" />
2724
<Compile Include="System\IO\__Error.cs" />
2825
<Compile Include="System\IO\Pipes\AnonymousPipeClientStream.cs" />
@@ -132,11 +129,10 @@
132129
<Compile Include="Microsoft\Win32\SafeHandles\SafePipeHandle.Windows.cs" />
133130
<Compile Include="System\IO\Pipes\AnonymousPipeServerStream.Windows.cs" />
134131
<Compile Include="System\IO\Pipes\ConnectionCompletionSource.cs" />
135-
<Compile Include="System\IO\Pipes\IOCancellationHelper.Windows.cs" />
136132
<Compile Include="System\IO\Pipes\NamedPipeClientStream.Windows.cs" />
137133
<Compile Include="System\IO\Pipes\NamedPipeServerStream.Windows.cs" />
134+
<Compile Include="System\IO\Pipes\PipeIOCompletionSource.cs" />
138135
<Compile Include="System\IO\Pipes\PipeStream.Windows.cs" />
139-
<Compile Include="System\IO\Pipes\PipeStreamAsyncResult.cs" />
140136
</ItemGroup>
141137
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
142138
<Compile Include="Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs" />

src/System.IO.Pipes/src/System/IO/Pipes/IOCancellationHelper.Windows.cs

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public int NumberOfServerInstances
112112
if (!Interop.mincore.GetNamedPipeHandleState(InternalHandle, IntPtr.Zero, out numInstances,
113113
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0))
114114
{
115-
WinIOError(Marshal.GetLastWin32Error());
115+
throw WinIOError(Marshal.GetLastWin32Error());
116116
}
117117

118118
return numInstances;

src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public String GetImpersonationUserName()
146146
if (!Interop.mincore.GetNamedPipeHandleState(InternalHandle, IntPtr.Zero, IntPtr.Zero,
147147
IntPtr.Zero, IntPtr.Zero, userName, userName.Capacity))
148148
{
149-
WinIOError(Marshal.GetLastWin32Error());
149+
throw WinIOError(Marshal.GetLastWin32Error());
150150
}
151151

152152
return userName.ToString();

0 commit comments

Comments
 (0)