Repository navigation
Bump .NET core framework to 3.1-preview.2 - #10993
Merged
Aditya Patwardhan (adityapatwardhan) merged 3 commits intoNov 7, 2019
Merged
Aditya Patwardhan (adityapatwardhan) merged 3 commits into
Aditya Patwardhan (adityapatwardhan) merged 3 commits into
Conversation
Aditya Patwardhan (adityapatwardhan)
requested review from
Travis Plunk (TravisEz13),
Andrew (anmenaga) and
Dongbo Wang (daxian-dbw)
as code owners
November 5, 2019 22:19
Travis Plunk (TravisEz13)
approved these changes
Nov 5, 2019
Andrew (anmenaga)
approved these changes
Nov 5, 2019
Aditya Patwardhan (adityapatwardhan)
force-pushed
the
UpdateDotNet3_1_p2
branch
from
November 6, 2019 00:04
e05f615 to
312f84a
Compare
Ilya (iSazonov)
approved these changes
Nov 7, 2019
| // The change was made in https://github.com/dotnet/coreclr/pull/27229 | ||
| // The recommendation from .NET team is to not check for 'completed' if 'flush' is false. | ||
| // Break out of the loop if all bytes have been read. | ||
| if (!flush && bytesRead == byteIndex) |
There was a problem hiding this comment.
Now that complete is useless, I think we'd better change this implementation a bit more. Like the following:
while (true)
{
// Read at most the number of bytes that will fit in the input buffer. The
// return value is the actual number of bytes read, or zero if no bytes remain.
bytesRead = stream.Read(bytes, 0, useBufferSize * 4);
if (bytesRead == 0)
{
break;
}
bool completed = false;
int byteIndex = 0;
int bytesUsed;
int charsUsed;
while (bytesRead > byteIndex)
{
// If this is the last input data, flush the decoder's internal buffer and state.
bool flush = (bytesRead == 0);
decoder.Convert(bytes, byteIndex, bytesRead - byteIndex,
chars, 0, useBufferSize, flush,
out bytesUsed, out charsUsed, out completed);
// The conversion produced the number of characters indicated by charsUsed. Write that number
// of characters to our result buffer
result.Append(chars, 0, charsUsed);
// Increment byteIndex to the next block of bytes in the input buffer, if any, to convert.
byteIndex += bytesUsed;
}
} while (bytesRead != 0);There was a problem hiding this comment.
Never mind. Change of the API makes it hard to reason about -- does decoder.Convert needs to be called again when bytesRead is 0? If it's needed, then will it produce any chars? If not, what's the purpose of doing so?
Without the understanding of those questions, let's keep the change as safe as possible, at least for now.
|
🎉 Handy links: |
Thatgfsj (Thatgfsj)
pushed a commit
to Thatgfsj-contribs/PowerShell
that referenced
this pull request
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
Move to .NET core 3.1-preview.2
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.