diff options
author | Justin Van Patten <jvp@justinvp.com> | 2017-08-17 19:29:25 +0300 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-08-17 19:29:25 +0300 |
commit | 6d7be63179868eac8d799c32846c3f724950abdd (patch) | |
tree | a0a926f1339075de3d13929df59fb6721dd86874 /src/System.Threading.Tasks.Extensions | |
parent | 0547375d71a7b0ea8e81e7690e2e6b0ceb6c70e6 (diff) |
System.Private.Xml: Use Encoding.Preamble (#23323)
* System.Private.Xml: Use Encoding.Preamble
Use the new `Encoding.Preamble` property to avoid unnecessary `byte[]`
allocations for encodings that return cached instances from `Preamble`
(e.g. all of the built-in encodings that have preambles).
* Avoid TypeLoadException in async code
Factor out the "eat preamble" code into its own method (that can be
reused by both the sync and async code) to prevent the
`ReadOnlySpan<byte>` preamble from being captured in a field of the
async state machine. This avoids the System.TypeLoadException : A value
type containing a by-ref instance field, such as Span<T>, cannot be used
as the type for a class instance field.
Diffstat (limited to 'src/System.Threading.Tasks.Extensions')
0 files changed, 0 insertions, 0 deletions