From 0029b8f0539f181ce0dad0f24b4387ca188d1d08 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Wed, 14 Nov 2018 20:05:26 +0000 Subject: [PATCH] Use non-pinnable buffer for zero byte read (#3094) --- src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs index 5d33f49829..42557a8802 100644 --- a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs +++ b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs @@ -15,7 +15,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal public SocketAwaitableEventArgs WaitForDataAsync() { +#if NETCOREAPP2_1 + _awaitableEventArgs.SetBuffer(Memory.Empty); +#else _awaitableEventArgs.SetBuffer(Array.Empty(), 0, 0); +#endif if (!_socket.ReceiveAsync(_awaitableEventArgs)) {