diff --git a/src/WebApiContrib.Core.Formatter.Csv/CsvInputFormatter.cs b/src/WebApiContrib.Core.Formatter.Csv/CsvInputFormatter.cs index cea4346..2394e23 100644 --- a/src/WebApiContrib.Core.Formatter.Csv/CsvInputFormatter.cs +++ b/src/WebApiContrib.Core.Formatter.Csv/CsvInputFormatter.cs @@ -90,9 +90,9 @@ protected async Task ReadStreamAsync(Type type, Stream stream) var reader = new StreamReader(stream, _options.Encoding); bool skipFirstLine = _options.UseSingleLineHeaderInCsv; - while (!reader.EndOfStream) + String line; + while ((line = await reader.ReadLineAsync()) != null) { - var line = await reader.ReadLineAsync(); var values = line.Split(_options.CsvDelimiter.ToCharArray()); if (skipFirstLine) {