-
Notifications
You must be signed in to change notification settings - Fork 385
Proper use of Stream.Read(buffer, offset, count) in the TemplateEngine.Core #3420
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
Conversation
8353e22
to
248dbae
Compare
int totalBytesRead = 0; | ||
if (!_isStream1Depleted) | ||
{ | ||
while (totalBytesRead < count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we do partial reads here and leave handling this to the caller, just like any other streams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's delay it when tests on InlineMarkupConditional (where CombinedStream is used) are written. I prefer to have keep implementation as is for now.
test/Microsoft.TemplateEngine.Core.UnitTests/ChunkStreamReadTests.cs
Outdated
Show resolved
Hide resolved
248dbae
to
51ca6df
Compare
6cf1122
to
1778339
Compare
1778339
to
1ef0d4b
Compare
1ef0d4b
to
16d0ec2
Compare
Problem
fixes #3325
The cause of the issue is: dotnet/runtime#53502, dotnet/docs#24649.
Solution
Affected code:
ProcessorState
- reading from stream in a loop until buffer is filled; added unit and integration testsCombinedStream
- reading from stream in a loop until count is reached; added unit testsInclude
- reading from stream in a loop until count is reachedMemoryStream.ToArray()
insteadInclude
is not covered with tests: extracted to #3438Checks:
#nullable enable
to all the modified files ? - partially