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

Commit f5b65d2

Browse files
committed
Merge pull request #2719 from Maxwe11/ArgumentNullException-msg
Pass message to ArgumentNullException in ReadAsync/WriteAsync
2 parents 3370679 + 9c21d46 commit f5b65d2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/System.IO.FileSystem/src/System/IO/FileStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public override int Read(byte[] buffer, int offset, int count)
224224
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
225225
{
226226
if (buffer == null)
227-
throw new ArgumentNullException("buffer");
227+
throw new ArgumentNullException("buffer", SR.ArgumentNull_Buffer);
228228
if (offset < 0)
229229
throw new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_NeedNonNegNum);
230230
if (count < 0)
@@ -266,7 +266,7 @@ public override void Write(byte[] buffer, int offset, int count)
266266
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
267267
{
268268
if (buffer == null)
269-
throw new ArgumentNullException("buffer");
269+
throw new ArgumentNullException("buffer", SR.ArgumentNull_Buffer);
270270
if (offset < 0)
271271
throw new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_NeedNonNegNum);
272272
if (count < 0)

src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public override int Read([In, Out] byte[] buffer, int offset, int count)
142142
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
143143
{
144144
if (buffer == null)
145-
throw new ArgumentNullException("buffer");
145+
throw new ArgumentNullException("buffer", SR.ArgumentNull_Buffer);
146146
if (offset < 0)
147147
throw new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_NeedNonNegNum);
148148
if (count < 0)
@@ -200,7 +200,7 @@ public override void Write(byte[] buffer, int offset, int count)
200200
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
201201
{
202202
if (buffer == null)
203-
throw new ArgumentNullException("buffer");
203+
throw new ArgumentNullException("buffer", SR.ArgumentNull_Buffer);
204204
if (offset < 0)
205205
throw new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_NeedNonNegNum);
206206
if (count < 0)

0 commit comments

Comments
 (0)