Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadLineAsync returns Null #97

Closed
thopdev opened this issue Dec 18, 2019 · 1 comment
Closed

ReadLineAsync returns Null #97

thopdev opened this issue Dec 18, 2019 · 1 comment

Comments

@thopdev
Copy link

thopdev commented Dec 18, 2019

Describe the bug
All lines read from files are null when build with --configuration Release

Code:
using var stream = await _fileReference.OpenReadAsync();
using var reader = new StreamReader(stream, Encoding.UTF8, true, 10000);
string line;
while ((line = await reader.ReadLineAsync()) != null)
{
yield return line;
}

line is always null when build with Release.

When building with Debug no problems occur.

@thopdev
Copy link
Author

thopdev commented Dec 19, 2019

Sorry problem was at my end,
while ((line = await reader.ReadLineAsync()) != null)
this didn't work on release
i replaced it with

         var line = await reader.ReadLineAsync();
            while (line  != null)
            {
                var returnLine = line;
                line = await reader.ReadLineAsync();
                yield return returnLine;
                
            }

This did work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant