This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
Fix regressions in FormReader / FileBufferingReadStream. #606
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#605 @davidfowl @muratg @benaadams @BrennanConroy
The recent perf changes caused two regressions in the FileBufferingReadStream used by form reader. The one reported in #605 is that most of the data buffered in memory gets discarded when transitioning to the file buffer. This happened because Write was accidentally given the wrong length when I cleaned up some of @benaadams's code.
The other regression was that the constructor only rented buffers if the in-memory threshold was less than 1mb, but Read always assumed it was using rented buffers. This would have caused ArgumentNullExceptions trying to use an uninitialized buffer. The fix is to rent a buffer when needed and do a manual CopyTo loop.
Compare with bd60507#diff-6bee66e850efacd8fe96daae334fa1c5R192