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.
Add APIs to
BlobBuilderfor customizing the underlying byte array et al. #115294New 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
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Add APIs to
BlobBuilderfor customizing the underlying byte array et al. #115294Changes from all commits
fd2a7e2d1b3914776a69f655ad387e419b08c078c70f8c96aff7ea5e31f3f24a9443c607987e4125164dbc81ac5ed979d9515e8255bd0a1d4c5ea72c0cb3570633ea52ea112182bd7032e8f0256fa2fdf4f7ebd89123d14558e2e7197db30e2def29cccafc672862c21cff15cf246b3282b65711fba2fa5cd6335194fd3ca96c633ad76eb0ce2dd025e3a5e89b5af320896dcc16ab3deFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Does this need to change at all? If this is for .NET Framework, I would just leave it as-is. There is little benefit to changing anything due to possibility of regressions.
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.
Yes. The method's old signature was harder to work with; it uses pointers, does not clearly state which buffer is read-only, and requires pre-computing the UTF-8 byte count.
I had to refactor SRM's UTF-8 encoder1 in order to improve code reusability and memory safety in modern frameworks, and take advantage of the
System.Text.Unicode.Utf8APIs. Originally, I tried adding a reference to theMicrosoft.Bcl.Memorypackage — which has a polyfill toUtf8, and this method had a single implementation. Adding the extra dependency to SRM however is not going to be simple, hence the custom code's re-introduction.Another idea if we want to avoid the extra package dependency, is to vendor the sources of
Utf8to SRM.Footnotes
which has unique requirements, because it is essentially a WTF-8 decoder ↩
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.