Fix logger CA2024: Do not use StreamReader.EndOfStream in async methods

This commit is contained in:
Richard Torhan
2025-11-27 18:00:27 +01:00
committed by Bond_009
parent 098e8c6fed
commit 140c459ac3

View File

@@ -27,10 +27,9 @@ namespace MediaBrowser.Controller.MediaEncoding
using (target)
using (reader)
{
while (!reader.EndOfStream && reader.BaseStream.CanRead)
string? line = await reader.ReadLineAsync().ConfigureAwait(false);
while (line is not null && reader.BaseStream.CanRead)
{
var line = await reader.ReadLineAsync().ConfigureAwait(false);
ParseLogLine(line, state);
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
@@ -50,6 +49,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
await target.FlushAsync().ConfigureAwait(false);
line = await reader.ReadLineAsync().ConfigureAwait(false);
}
}
}