Skip to content

Commit 2444ad0

Browse files
authored
Remove CopyTo{Async} delegate overloads (#37750)
We added these earlier in the .NET 5 cycle, but they're not providing the benefits we hoped, and are likely to cause confusion and actually result in de-optimizations in some cases. We can re-add them in the future should a stronger need / impact present itself.
1 parent 518df4f commit 2444ad0

File tree

7 files changed

+0
-784
lines changed

7 files changed

+0
-784
lines changed

src/libraries/Common/src/System/IO/StreamHelpers.CopyValidation.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,5 @@ public static void ValidateCopyToArgs(Stream source, Stream destination, int buf
4242
throw new NotSupportedException(SR.NotSupported_UnwritableStream);
4343
}
4444
}
45-
46-
public static void ValidateCopyToArgs(Stream source, Delegate callback, int bufferSize)
47-
{
48-
if (callback == null)
49-
{
50-
throw new ArgumentNullException(nameof(callback));
51-
}
52-
53-
if (bufferSize <= 0)
54-
{
55-
throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, SR.ArgumentOutOfRange_NeedPosNum);
56-
}
57-
58-
if (!source.CanRead)
59-
{
60-
throw source.CanWrite ? (Exception)
61-
new NotSupportedException(SR.NotSupported_UnreadableStream) :
62-
new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
63-
}
64-
}
6545
}
6646
}

0 commit comments

Comments
 (0)