Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpContent.cs
Go to the documentation of this file.
4using System.IO;
6using System.Text;
9
10namespace System.Net.Http;
11
12public abstract class HttpContent : IDisposable
13{
14 internal sealed class LimitMemoryStream : MemoryStream
15 {
16 private readonly int _maxSize;
17
18 public LimitMemoryStream(int maxSize, int capacity)
19 : base(capacity)
20 {
21 _maxSize = maxSize;
22 }
23
24 public byte[] GetSizedBuffer()
25 {
26 if (!TryGetBuffer(out var buffer) || buffer.Offset != 0 || buffer.Count != buffer.Array.Length)
27 {
28 return ToArray();
29 }
30 return buffer.Array;
31 }
32
33 public override void Write(byte[] buffer, int offset, int count)
34 {
36 base.Write(buffer, offset, count);
37 }
38
39 public override void WriteByte(byte value)
40 {
41 CheckSize(1);
42 base.WriteByte(value);
43 }
44
46 {
48 return base.WriteAsync(buffer, offset, count, cancellationToken);
49 }
50
52 {
53 CheckSize(buffer.Length);
54 return base.WriteAsync(buffer, cancellationToken);
55 }
56
57 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
58 {
60 return base.BeginWrite(buffer, offset, count, callback, state);
61 }
62
63 public override void EndWrite(IAsyncResult asyncResult)
64 {
65 base.EndWrite(asyncResult);
66 }
67
69 {
70 if (TryGetBuffer(out var buffer))
71 {
73 long position = Position;
74 long num = (Position = Length);
75 long num2 = num - position;
76 return destination.WriteAsync(buffer.Array, (int)(buffer.Offset + position), (int)num2, cancellationToken);
77 }
78 return base.CopyToAsync(destination, bufferSize, cancellationToken);
79 }
80
81 private void CheckSize(int countToAdd)
82 {
83 if (_maxSize - Length < countToAdd)
84 {
86 }
87 }
88 }
89
90 internal sealed class LimitArrayPoolWriteStream : Stream
91 {
92 private readonly int _maxBufferSize;
93
94 private byte[] _buffer;
95
96 private int _length;
97
98 public override long Length => _length;
99
100 public override bool CanWrite => true;
101
102 public override bool CanRead => false;
103
104 public override bool CanSeek => false;
105
106 public override long Position
107 {
108 get
109 {
110 throw new NotSupportedException();
111 }
112 set
113 {
114 throw new NotSupportedException();
115 }
116 }
117
118 public LimitArrayPoolWriteStream(int maxBufferSize)
119 : this(maxBufferSize, 256L)
120 {
121 }
122
123 public LimitArrayPoolWriteStream(int maxBufferSize, long capacity)
124 {
125 if (capacity < 256)
126 {
127 capacity = 256L;
128 }
129 else if (capacity > maxBufferSize)
130 {
131 throw CreateOverCapacityException(maxBufferSize);
132 }
133 _maxBufferSize = maxBufferSize;
135 }
136
137 protected override void Dispose(bool disposing)
138 {
140 _buffer = null;
141 base.Dispose(disposing);
142 }
143
145 {
146 return new ArraySegment<byte>(_buffer, 0, _length);
147 }
148
149 public byte[] ToArray()
150 {
151 byte[] array = new byte[_length];
153 return array;
154 }
155
156 private void EnsureCapacity(int value)
157 {
158 if ((uint)value > (uint)_maxBufferSize)
159 {
161 }
162 if (value > _buffer.Length)
163 {
164 Grow(value);
165 }
166 }
167
168 private void Grow(int value)
169 {
170 byte[] buffer = _buffer;
171 _buffer = null;
172 uint num = (uint)(2 * buffer.Length);
173 int minimumLength = ((num > Array.MaxLength) ? Math.Max(value, Array.MaxLength) : Math.Max(value, (int)num));
174 byte[] array = ArrayPool<byte>.Shared.Rent(minimumLength);
177 _buffer = array;
178 }
179
180 public override void Write(byte[] buffer, int offset, int count)
181 {
184 _length += count;
185 }
186
187 public override void Write(ReadOnlySpan<byte> buffer)
188 {
189 EnsureCapacity(_length + buffer.Length);
190 buffer.CopyTo(new Span<byte>(_buffer, _length, buffer.Length));
191 _length += buffer.Length;
192 }
193
195 {
197 return Task.CompletedTask;
198 }
199
201 {
202 Write(buffer.Span);
203 return default(ValueTask);
204 }
205
206 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
207 {
208 return System.Threading.Tasks.TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState);
209 }
210
215
216 public override void WriteByte(byte value)
217 {
218 int num = _length + 1;
219 EnsureCapacity(num);
221 _length = num;
222 }
223
224 public override void Flush()
225 {
226 }
227
229 {
230 return Task.CompletedTask;
231 }
232
233 public override int Read(byte[] buffer, int offset, int count)
234 {
235 throw new NotSupportedException();
236 }
237
238 public override long Seek(long offset, SeekOrigin origin)
239 {
240 throw new NotSupportedException();
241 }
242
243 public override void SetLength(long value)
244 {
245 throw new NotSupportedException();
246 }
247 }
248
250
252
253 private object _contentReadStream;
254
255 private bool _disposed;
256
258
259 internal static readonly Encoding DefaultStringEncoding = Encoding.UTF8;
260
261 public HttpContentHeaders Headers
262 {
263 get
264 {
265 if (_headers == null)
266 {
267 _headers = new HttpContentHeaders(this);
268 }
269 return _headers;
270 }
271 }
272
273 private bool IsBuffered => _bufferedContent != null;
274
275 internal virtual bool AllowDuplex => true;
276
278 {
279 if (_bufferedContent != null)
280 {
282 }
283 buffer = default(ArraySegment<byte>);
284 return false;
285 }
286
287 protected HttpContent()
288 {
289 if (System.Net.NetEventSource.Log.IsEnabled())
290 {
291 System.Net.NetEventSource.Info(this, null, ".ctor");
292 }
293 _canCalculateLength = true;
294 }
295
300
302 {
304 return WaitAndReturnAsync(LoadIntoBufferAsync(cancellationToken), this, (HttpContent s) => s.ReadBufferedContentAsString());
305 }
306
308 {
309 if (_bufferedContent.Length == 0L)
310 {
311 return string.Empty;
312 }
313 if (!TryGetBuffer(out var buffer))
314 {
316 }
317 return ReadBufferAsString(buffer, Headers);
318 }
319
321 {
322 Encoding encoding = null;
323 int preambleLength = -1;
324 string text = headers.ContentType?.CharSet;
325 if (text != null)
326 {
327 try
328 {
329 encoding = ((text.Length <= 2 || text[0] != '"' || text[text.Length - 1] != '"') ? Encoding.GetEncoding(text) : Encoding.GetEncoding(text.Substring(1, text.Length - 2)));
330 preambleLength = GetPreambleLength(buffer, encoding);
331 }
332 catch (ArgumentException innerException)
333 {
335 }
336 }
337 if (encoding == null && !TryDetectEncoding(buffer, out encoding, out preambleLength))
338 {
339 encoding = DefaultStringEncoding;
340 preambleLength = 0;
341 }
342 return encoding.GetString(buffer.Array, buffer.Offset + preambleLength, buffer.Count - preambleLength);
343 }
344
349
351 {
353 return WaitAndReturnAsync(LoadIntoBufferAsync(cancellationToken), this, (HttpContent s) => s.ReadBufferedContentAsByteArray());
354 }
355
357 {
358 return _bufferedContent.ToArray();
359 }
360
362 {
364 }
365
367 {
370 if (_contentReadStream == null)
371 {
372 return (Stream)(_contentReadStream = (TryGetBuffer(out buffer) ? new MemoryStream(buffer.Array, buffer.Offset, buffer.Count, writable: false) : CreateContentReadStream(cancellationToken)));
373 }
374 if (_contentReadStream is Stream result)
375 {
376 return result;
377 }
379 }
380
385
387 {
390 if (_contentReadStream == null)
391 {
392 return (Task<Stream>)(_contentReadStream = (TryGetBuffer(out buffer) ? ((Task)Task.FromResult((Stream)new MemoryStream(buffer.Array, buffer.Offset, buffer.Count, writable: false))) : ((Task)CreateContentReadStreamAsync(cancellationToken))));
393 }
394 if (_contentReadStream is Task<Stream> result)
395 {
396 return result;
397 }
399 }
400
402 {
405 if (_contentReadStream == null)
406 {
407 return (Stream)(_contentReadStream = (TryGetBuffer(out buffer) ? new MemoryStream(buffer.Array, buffer.Offset, buffer.Count, writable: false) : TryCreateContentReadStream()));
408 }
409 if (_contentReadStream is Stream result)
410 {
411 return result;
412 }
414 if (task.Status != TaskStatus.RanToCompletion)
415 {
416 return null;
417 }
418 return task.Result;
419 }
420
422
424 {
425 throw new NotSupportedException(System.SR.Format(System.SR.net_http_missing_sync_implementation, GetType(), "HttpContent", "SerializeToStream"));
426 }
427
432
434 {
436 if (stream == null)
437 {
438 throw new ArgumentNullException("stream");
439 }
440 try
441 {
442 if (TryGetBuffer(out var buffer))
443 {
444 stream.Write(buffer.Array, buffer.Offset, buffer.Count);
445 }
446 else
447 {
449 }
450 }
451 catch (Exception ex) when (StreamCopyExceptionNeedsWrapping(ex))
452 {
453 throw GetStreamCopyException(ex);
454 }
455 }
456
461
466
468 {
469 return CopyToAsync(stream, context, CancellationToken.None);
470 }
471
473 {
475 if (stream == null)
476 {
477 throw new ArgumentNullException("stream");
478 }
479 try
480 {
481 return WaitAsync(InternalCopyToAsync(stream, context, cancellationToken));
482 }
483 catch (Exception ex) when (StreamCopyExceptionNeedsWrapping(ex))
484 {
486 }
487 static async Task WaitAsync(ValueTask copyTask)
488 {
489 try
490 {
491 await copyTask.ConfigureAwait(continueOnCapturedContext: false);
492 }
494 {
496 }
497 }
498 }
499
510
511 internal void LoadIntoBuffer(long maxBufferSize, CancellationToken cancellationToken)
512 {
514 if (!CreateTemporaryBuffer(maxBufferSize, out var tempBuffer, out var error))
515 {
516 return;
517 }
518 if (tempBuffer == null)
519 {
520 throw error;
521 }
522 CancellationTokenRegistration cancellationTokenRegistration = cancellationToken.Register(delegate(object s)
523 {
524 ((HttpContent)s).Dispose();
525 }, this);
526 try
527 {
528 SerializeToStream(tempBuffer, null, cancellationToken);
529 tempBuffer.Seek(0L, SeekOrigin.Begin);
530 _bufferedContent = tempBuffer;
531 }
532 catch (Exception ex)
533 {
534 if (System.Net.NetEventSource.Log.IsEnabled())
535 {
536 System.Net.NetEventSource.Error(this, ex, "LoadIntoBuffer");
537 }
539 {
541 }
543 {
544 throw GetStreamCopyException(ex);
545 }
546 throw;
547 }
548 finally
549 {
550 cancellationTokenRegistration.Dispose();
551 }
552 }
553
555 {
556 return LoadIntoBufferAsync(2147483647L);
557 }
558
559 public Task LoadIntoBufferAsync(long maxBufferSize)
560 {
561 return LoadIntoBufferAsync(maxBufferSize, CancellationToken.None);
562 }
563
568
570 {
572 if (!CreateTemporaryBuffer(maxBufferSize, out var tempBuffer, out var error))
573 {
574 return Task.CompletedTask;
575 }
576 if (tempBuffer == null)
577 {
578 return Task.FromException(error);
579 }
580 try
581 {
584 return LoadIntoBufferAsyncCore(task, tempBuffer);
585 }
586 catch (Exception ex) when (StreamCopyExceptionNeedsWrapping(ex))
587 {
589 }
590 }
591
592 private async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
593 {
594 try
595 {
596 await serializeToStreamTask.ConfigureAwait(continueOnCapturedContext: false);
597 }
598 catch (Exception ex)
599 {
600 tempBuffer.Dispose();
601 Exception streamCopyException = GetStreamCopyException(ex);
602 if (streamCopyException != ex)
603 {
604 throw streamCopyException;
605 }
606 throw;
607 }
608 try
609 {
610 tempBuffer.Seek(0L, SeekOrigin.Begin);
611 _bufferedContent = tempBuffer;
612 }
613 catch (Exception message)
614 {
615 if (System.Net.NetEventSource.Log.IsEnabled())
616 {
617 System.Net.NetEventSource.Error(this, message, "LoadIntoBufferAsyncCore");
618 }
619 throw;
620 }
621 }
622
628
630 {
631 return WaitAndReturnAsync(LoadIntoBufferAsync(), this, (Func<HttpContent, Stream>)((HttpContent s) => s._bufferedContent));
632 }
633
638
640 {
641 return null;
642 }
643
644 protected internal abstract bool TryComputeLength(out long length);
645
647 {
649 if (IsBuffered)
650 {
652 }
654 {
655 long length = 0L;
656 if (TryComputeLength(out length))
657 {
658 return length;
659 }
660 _canCalculateLength = false;
661 }
662 return null;
663 }
664
665 private bool CreateTemporaryBuffer(long maxBufferSize, out MemoryStream tempBuffer, out Exception error)
666 {
667 if (maxBufferSize > int.MaxValue)
668 {
669 throw new ArgumentOutOfRangeException("maxBufferSize", maxBufferSize, System.SR.Format(CultureInfo.InvariantCulture, System.SR.net_http_content_buffersize_limit, int.MaxValue));
670 }
671 if (IsBuffered)
672 {
673 tempBuffer = null;
674 error = null;
675 return false;
676 }
677 tempBuffer = CreateMemoryStream(maxBufferSize, out error);
678 return true;
679 }
680
681 private MemoryStream CreateMemoryStream(long maxBufferSize, out Exception error)
682 {
683 error = null;
684 long? contentLength = Headers.ContentLength;
685 if (contentLength.HasValue)
686 {
687 if (contentLength > maxBufferSize)
688 {
690 return null;
691 }
692 return new LimitMemoryStream((int)maxBufferSize, (int)contentLength.Value);
693 }
694 return new LimitMemoryStream((int)maxBufferSize, 0);
695 }
696
697 protected virtual void Dispose(bool disposing)
698 {
699 if (disposing && !_disposed)
700 {
701 _disposed = true;
702 if (_contentReadStream != null)
703 {
704 ((_contentReadStream as Stream) ?? ((_contentReadStream is Task<Stream> { Status: TaskStatus.RanToCompletion } task) ? task.Result : null))?.Dispose();
705 _contentReadStream = null;
706 }
707 if (IsBuffered)
708 {
710 }
711 }
712 }
713
714 public void Dispose()
715 {
716 Dispose(disposing: true);
717 GC.SuppressFinalize(this);
718 }
719
720 private void CheckDisposed()
721 {
722 if (_disposed)
723 {
724 throw new ObjectDisposedException(GetType().ToString());
725 }
726 }
727
729 {
730 if (task == null)
731 {
733 if (System.Net.NetEventSource.Log.IsEnabled())
734 {
735 System.Net.NetEventSource.Error(this, ex, "CheckTaskNotNull");
736 }
737 throw ex;
738 }
739 }
740
742 {
743 if (!(e is IOException))
744 {
745 return e is ObjectDisposedException;
746 }
747 return true;
748 }
749
750 private static Exception GetStreamCopyException(Exception originalException)
751 {
752 if (!StreamCopyExceptionNeedsWrapping(originalException))
753 {
754 return originalException;
755 }
756 return WrapStreamCopyException(originalException);
757 }
758
763
765 {
766 byte[] array = buffer.Array;
767 int offset = buffer.Offset;
768 int count = buffer.Count;
769 switch (encoding.CodePage)
770 {
771 case 65001:
772 if (count < 3 || array[offset] != 239 || array[offset + 1] != 187 || array[offset + 2] != 191)
773 {
774 return 0;
775 }
776 return 3;
777 case 12000:
778 if (count < 4 || array[offset] != byte.MaxValue || array[offset + 1] != 254 || array[offset + 2] != 0 || array[offset + 3] != 0)
779 {
780 return 0;
781 }
782 return 4;
783 case 1200:
784 if (count < 2 || array[offset] != byte.MaxValue || array[offset + 1] != 254)
785 {
786 return 0;
787 }
788 return 2;
789 case 1201:
790 if (count < 2 || array[offset] != 254 || array[offset + 1] != byte.MaxValue)
791 {
792 return 0;
793 }
794 return 2;
795 default:
796 {
797 byte[] preamble = encoding.GetPreamble();
798 if (!BufferHasPrefix(buffer, preamble))
799 {
800 return 0;
801 }
802 return preamble.Length;
803 }
804 }
805 }
806
807 private static bool TryDetectEncoding(ArraySegment<byte> buffer, [NotNullWhen(true)] out Encoding encoding, out int preambleLength)
808 {
809 byte[] array = buffer.Array;
810 int offset = buffer.Offset;
811 int count = buffer.Count;
812 if (count >= 2)
813 {
814 switch ((array[offset] << 8) | array[offset + 1])
815 {
816 case 61371:
817 if (count >= 3 && array[offset + 2] == 191)
818 {
819 encoding = Encoding.UTF8;
820 preambleLength = 3;
821 return true;
822 }
823 break;
824 case 65534:
825 if (count >= 4 && array[offset + 2] == 0 && array[offset + 3] == 0)
826 {
827 encoding = Encoding.UTF32;
828 preambleLength = 4;
829 }
830 else
831 {
832 encoding = Encoding.Unicode;
833 preambleLength = 2;
834 }
835 return true;
836 case 65279:
837 encoding = Encoding.BigEndianUnicode;
838 preambleLength = 2;
839 return true;
840 }
841 }
842 encoding = null;
843 preambleLength = 0;
844 return false;
845 }
846
847 private static bool BufferHasPrefix(ArraySegment<byte> buffer, byte[] prefix)
848 {
849 byte[] array = buffer.Array;
850 if (prefix == null || array == null || prefix.Length > buffer.Count || prefix.Length == 0)
851 {
852 return false;
853 }
854 int num = 0;
855 int num2 = buffer.Offset;
856 while (num < prefix.Length)
857 {
858 if (prefix[num] != array[num2])
859 {
860 return false;
861 }
862 num++;
863 num2++;
864 }
865 return true;
866 }
867
868 private static async Task<TResult> WaitAndReturnAsync<TState, TResult>(Task waitTask, TState state, Func<TState, TResult> returnFunc)
869 {
870 await waitTask.ConfigureAwait(continueOnCapturedContext: false);
871 return returnFunc(state);
872 }
873
874 private static Exception CreateOverCapacityException(int maxBufferSize)
875 {
877 }
878}
static int MaxLength
Definition Array.cs:471
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
Definition Buffer.cs:102
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
static CultureInfo InvariantCulture
override long Seek(long offset, SeekOrigin loc)
override long Position
virtual bool TryGetBuffer(out ArraySegment< byte > buffer)
override void Dispose(bool disposing)
virtual byte[] ToArray()
static void ValidateCopyToArguments(Stream destination, int bufferSize)
Definition Stream.cs:1060
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static bool ShouldWrapInOperationCanceledException(Exception exception, CancellationToken cancellationToken)
static Exception CreateOperationCanceledException(Exception innerException, CancellationToken cancellationToken)
override long Seek(long offset, SeekOrigin origin)
override int Read(byte[] buffer, int offset, int count)
override void Write(ReadOnlySpan< byte > buffer)
override void EndWrite(IAsyncResult asyncResult)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
LimitArrayPoolWriteStream(int maxBufferSize, long capacity)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
override Task FlushAsync(CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
LimitMemoryStream(int maxSize, int capacity)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken)
override void EndWrite(IAsyncResult asyncResult)
override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
static Exception WrapStreamCopyException(Exception e)
virtual Task< Stream > CreateContentReadStreamAsync()
static bool TryDetectEncoding(ArraySegment< byte > buffer, [NotNullWhen(true)] out Encoding encoding, out int preambleLength)
Task< Stream > ReadAsStreamAsync()
void CopyTo(Stream stream, TransportContext? context, CancellationToken cancellationToken)
static Exception CreateOverCapacityException(int maxBufferSize)
static bool BufferHasPrefix(ArraySegment< byte > buffer, byte[] prefix)
Task< byte[]> ReadAsByteArrayAsync()
Task CopyToAsync(Stream stream, CancellationToken cancellationToken)
static bool StreamCopyExceptionNeedsWrapping(Exception e)
Task SerializeToStreamAsync(Stream stream, TransportContext? context)
static Exception GetStreamCopyException(Exception originalException)
virtual Stream CreateContentReadStream(CancellationToken cancellationToken)
void LoadIntoBuffer(long maxBufferSize, CancellationToken cancellationToken)
bool CreateTemporaryBuffer(long maxBufferSize, out MemoryStream tempBuffer, out Exception error)
Task LoadIntoBufferAsync(CancellationToken cancellationToken)
Task< Stream > ReadAsStreamAsync(CancellationToken cancellationToken)
HttpContentHeaders _headers
Task< string > ReadAsStringAsync(CancellationToken cancellationToken)
virtual Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken)
Task LoadIntoBufferAsync(long maxBufferSize)
Task CopyToAsync(Stream stream)
static int GetPreambleLength(ArraySegment< byte > buffer, Encoding encoding)
static readonly Encoding DefaultStringEncoding
ValueTask InternalCopyToAsync(Stream stream, TransportContext context, CancellationToken cancellationToken)
async Task LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
Task LoadIntoBufferAsync(long maxBufferSize, CancellationToken cancellationToken)
virtual void Dispose(bool disposing)
bool TryComputeLength(out long length)
MemoryStream CreateMemoryStream(long maxBufferSize, out Exception error)
Task< string > ReadAsStringAsync()
Task CopyToAsync(Stream stream, TransportContext? context)
virtual Task< Stream > CreateContentReadStreamAsync(CancellationToken cancellationToken)
void CheckTaskNotNull(Task task)
static string ReadBufferAsString(ArraySegment< byte > buffer, HttpContentHeaders headers)
Task CopyToAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken)
Stream ReadAsStream(CancellationToken cancellationToken)
static async Task< TResult > WaitAndReturnAsync< TState, TResult >(Task waitTask, TState state, Func< TState, TResult > returnFunc)
Task< byte[]> ReadAsByteArrayAsync(CancellationToken cancellationToken)
bool TryGetBuffer(out ArraySegment< byte > buffer)
virtual void SerializeToStream(Stream stream, TransportContext? context, CancellationToken cancellationToken)
virtual Stream TryCreateContentReadStream()
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string net_http_missing_sync_implementation
Definition SR.cs:194
static string net_http_content_stream_copy_error
Definition SR.cs:48
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_http_content_buffersize_exceeded
Definition SR.cs:38
static string net_http_content_no_task_returned
Definition SR.cs:40
static string net_http_content_buffersize_limit
Definition SR.cs:84
static string net_http_content_read_as_stream_has_task
Definition SR.cs:50
static string net_http_content_invalid_charset
Definition SR.cs:46
Definition SR.cs:7
static Encoding BigEndianUnicode
Definition Encoding.cs:521
static Encoding Unicode
Definition Encoding.cs:519
static Encoding UTF8
Definition Encoding.cs:526
static Encoding GetEncoding(int codepage)
Definition Encoding.cs:593
static Encoding UTF32
Definition Encoding.cs:528
virtual int CodePage
Definition Encoding.cs:515
virtual byte[] GetPreamble()
Definition Encoding.cs:689
unsafe string GetString(byte *bytes, int byteCount)
Definition Encoding.cs:973
static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
Definition TaskToApm.cs:43
static void End(IAsyncResult asyncResult)
Definition TaskToApm.cs:48
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
static Task FromException(Exception exception)
Definition Task.cs:3341
static Task CompletedTask
Definition Task.cs:1120
ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)
Definition ValueTask.cs:312