diff --git a/src/Common/MemoryBufferWriter.cs b/src/Common/MemoryBufferWriter.cs index adf5820429..2b0fa29d62 100644 --- a/src/Common/MemoryBufferWriter.cs +++ b/src/Common/MemoryBufferWriter.cs @@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Internal #if NETCOREAPP2_1 public override void Write(ReadOnlySpan span) { - if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan().Slice(_position))) + if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan(_position))) { _position += span.Length; _bytesWritten += span.Length; diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs index 0bebfc3ebc..58cba9e36a 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs @@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); logger.LogInformation("Received {length} byte frame", result.Count); - Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray()); + Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout(); @@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout(); logger.LogInformation("Received {length} byte frame", result.Count); - Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray()); + Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); logger.LogInformation("Closing socket"); await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();