paulirwin commented on code in PR #1052:
URL: https://github.com/apache/lucenenet/pull/1052#discussion_r1866527726
##########
src/Lucene.Net.Tests.Replicator/IndexInputStreamTest.cs:
##########
@@ -55,7 +58,10 @@ public void
Read_RemainingIndexInputLargerThanReadCount_ReturnsExpectedSection([
int readBytes = 1.KiloBytes();
byte[] readBuffer = new byte[readBytes];
for (int i = section; i > 0; i--)
- stream.Read(readBuffer, 0, readBytes);
+ {
+ stream.ReadExactly(readBuffer, 0, readBytes); // LUCENENET
specific - calling ReadExactly to ensure we read the exact number of bytes
Review Comment:
Well, if we're going to check the length, might as well just check how many
bytes were read and assert that, which removes the need for this method
entirely. The .NET 9 build warning only applies if the return value of Read is
ignored. I'm going to remove the extension method and just do that, solves the
problem with StreamExtensions anyways. We can always easily add the extension
back later when we add a .NET 9+ target if there are cases where we are reading
without checking the number read elsewhere in the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]